Files
old-ribica/back-office/test/controllers/item_in_groups_controller_test.rb

50 lines
1.3 KiB
Ruby

require 'test_helper'
class ItemInGroupsControllerTest < ActionController::TestCase
setup do
@item_in_group = item_in_groups(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:item_in_groups)
end
test "should get new" do
get :new
assert_response :success
end
test "should create item_in_group" do
assert_difference('ItemInGroup.count') do
post :create, item_in_group: { item_group_id: @item_in_group.item_group_id, item_id: @item_in_group.item_id, position: @item_in_group.position }
end
assert_redirected_to item_in_group_path(assigns(:item_in_group))
end
test "should show item_in_group" do
get :show, id: @item_in_group
assert_response :success
end
test "should get edit" do
get :edit, id: @item_in_group
assert_response :success
end
test "should update item_in_group" do
patch :update, id: @item_in_group, item_in_group: { item_group_id: @item_in_group.item_group_id, item_id: @item_in_group.item_id, position: @item_in_group.position }
assert_redirected_to item_in_group_path(assigns(:item_in_group))
end
test "should destroy item_in_group" do
assert_difference('ItemInGroup.count', -1) do
delete :destroy, id: @item_in_group
end
assert_redirected_to item_in_groups_path
end
end