created items and configured back office ui a bit
This commit is contained in:
49
test/controllers/items_controller_test.rb
Normal file
49
test/controllers/items_controller_test.rb
Normal file
@@ -0,0 +1,49 @@
|
||||
require 'test_helper'
|
||||
|
||||
class ItemsControllerTest < ActionController::TestCase
|
||||
setup do
|
||||
@item = items(:one)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
get :index
|
||||
assert_response :success
|
||||
assert_not_nil assigns(:items)
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
get :new
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create item" do
|
||||
assert_difference('Item.count') do
|
||||
post :create, item: { code: @item.code, current_input_price: @item.current_input_price, description: @item.description, list_price: @item.list_price, name: @item.name, on_display: @item.on_display, stock: @item.stock, sub_category_id: @item.sub_category_id, unit_id: @item.unit_id, units_in_pack: @item.units_in_pack }
|
||||
end
|
||||
|
||||
assert_redirected_to item_path(assigns(:item))
|
||||
end
|
||||
|
||||
test "should show item" do
|
||||
get :show, id: @item
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
get :edit, id: @item
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update item" do
|
||||
patch :update, id: @item, item: { code: @item.code, current_input_price: @item.current_input_price, description: @item.description, list_price: @item.list_price, name: @item.name, on_display: @item.on_display, stock: @item.stock, sub_category_id: @item.sub_category_id, unit_id: @item.unit_id, units_in_pack: @item.units_in_pack }
|
||||
assert_redirected_to item_path(assigns(:item))
|
||||
end
|
||||
|
||||
test "should destroy item" do
|
||||
assert_difference('Item.count', -1) do
|
||||
delete :destroy, id: @item
|
||||
end
|
||||
|
||||
assert_redirected_to items_path
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user