require 'test_helper' <% module_namespacing do -%> class <%= prefixed_controller_class_name %>ControllerTest < ActionDispatch::IntegrationTest setup do @<%= singular_table_name %> = <%= table_name %>(:one) end test "should get index" do get <%= prefixed_index_helper %>_url assert_response :success end test "should get new" do get new_<%= prefixed_plain_model_url %>_url assert_response :success end test "should create <%= singular_table_name %>" do assert_difference('<%= class_name %>.count') do post <%= prefixed_index_helper %>_url, params: { <%= "#{singular_table_name}: { #{attributes_hash} }" %> } end assert_redirected_to <%= prefixed_plain_model_url %>_url(<%= singular_table_name_camelcase %>.last) end test "should show <%= singular_table_name %>" do get <%= prefixed_plain_model_url %>_url(@<%= singular_table_name %>) assert_response :success end test "should get edit" do get edit_<%= prefixed_plain_model_url %>_url(@<%= singular_table_name %>) assert_response :success end test "should update <%= singular_table_name %>" do patch <%= prefixed_plain_model_url %>_url(@<%= singular_table_name %>), params: { <%= "#{singular_table_name}: { #{attributes_hash} }" %> } assert_redirected_to <%= prefixed_plain_model_url %>_url(<%= singular_table_name_camelcase %>.last) end test "should destroy <%= singular_table_name %>" do assert_difference('<%= class_name %>.count', -1) do delete <%= prefixed_plain_model_url %>_url(@<%= singular_table_name %>) end assert_redirected_to <%= prefixed_index_helper %>_url end end <% end -%>