rails-caf/test/controllers/cafs_controller_test.rb
2022-04-07 12:45:09 +01:00

49 lines
1.0 KiB
Ruby

require "test_helper"
class CafsControllerTest < ActionDispatch::IntegrationTest
setup do
@caf = cafs(:one)
end
test "should get index" do
get cafs_url
assert_response :success
end
test "should get new" do
get new_caf_url
assert_response :success
end
test "should create caf" do
assert_difference("Caf.count") do
post cafs_url, params: { caf: { company_id: @caf.company_id, description: @caf.description, name: @caf.name } }
end
assert_redirected_to caf_url(Caf.last)
end
test "should show caf" do
get caf_url(@caf)
assert_response :success
end
test "should get edit" do
get edit_caf_url(@caf)
assert_response :success
end
test "should update caf" do
patch caf_url(@caf), params: { caf: { company_id: @caf.company_id, description: @caf.description, name: @caf.name } }
assert_redirected_to caf_url(@caf)
end
test "should destroy caf" do
assert_difference("Caf.count", -1) do
delete caf_url(@caf)
end
assert_redirected_to cafs_url
end
end