added suppliers, weight to item
This commit is contained in:
49
back-office/test/controllers/suppliers_controller_test.rb
Normal file
49
back-office/test/controllers/suppliers_controller_test.rb
Normal file
@@ -0,0 +1,49 @@
|
||||
require 'test_helper'
|
||||
|
||||
class SuppliersControllerTest < ActionController::TestCase
|
||||
setup do
|
||||
@supplier = suppliers(:one)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
get :index
|
||||
assert_response :success
|
||||
assert_not_nil assigns(:suppliers)
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
get :new
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create supplier" do
|
||||
assert_difference('Supplier.count') do
|
||||
post :create, supplier: { address: @supplier.address, contact_person: @supplier.contact_person, email: @supplier.email, name: @supplier.name, note: @supplier.note, phone: @supplier.phone, postal_code: @supplier.postal_code, town: @supplier.town }
|
||||
end
|
||||
|
||||
assert_redirected_to supplier_path(assigns(:supplier))
|
||||
end
|
||||
|
||||
test "should show supplier" do
|
||||
get :show, id: @supplier
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
get :edit, id: @supplier
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update supplier" do
|
||||
patch :update, id: @supplier, supplier: { address: @supplier.address, contact_person: @supplier.contact_person, email: @supplier.email, name: @supplier.name, note: @supplier.note, phone: @supplier.phone, postal_code: @supplier.postal_code, town: @supplier.town }
|
||||
assert_redirected_to supplier_path(assigns(:supplier))
|
||||
end
|
||||
|
||||
test "should destroy supplier" do
|
||||
assert_difference('Supplier.count', -1) do
|
||||
delete :destroy, id: @supplier
|
||||
end
|
||||
|
||||
assert_redirected_to suppliers_path
|
||||
end
|
||||
end
|
||||
21
back-office/test/fixtures/suppliers.yml
vendored
Normal file
21
back-office/test/fixtures/suppliers.yml
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
name: MyString
|
||||
address: MyString
|
||||
postal_code: MyString
|
||||
town: MyString
|
||||
phone: MyString
|
||||
contact_person: MyString
|
||||
email: MyString
|
||||
note: MyText
|
||||
|
||||
two:
|
||||
name: MyString
|
||||
address: MyString
|
||||
postal_code: MyString
|
||||
town: MyString
|
||||
phone: MyString
|
||||
contact_person: MyString
|
||||
email: MyString
|
||||
note: MyText
|
||||
7
back-office/test/models/supplier_test.rb
Normal file
7
back-office/test/models/supplier_test.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
class SupplierTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
||||
Reference in New Issue
Block a user