added suppliers, weight to item

This commit is contained in:
Senad Uka
2015-03-14 06:33:49 +01:00
parent 0bafbb4b2f
commit e7793f0884
17 changed files with 304 additions and 2 deletions

View 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
View 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

View File

@@ -0,0 +1,7 @@
require 'test_helper'
class SupplierTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end