aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb')
-rw-r--r--railties/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/railties/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb b/railties/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb
index 412ecb8db1..f302cd6c3d 100644
--- a/railties/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb
+++ b/railties/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb
@@ -1,7 +1,7 @@
require 'test_helper'
<% module_namespacing do -%>
-class <%= controller_class_name %>ControllerTest < ActionDispatch::IntegrationTest
+class <%= controller_class_name %>ControllerTest < ActionController::TestCase
setup do
@<%= singular_table_name %> = <%= fixture_name %>(:one)
<% if mountable_engine? -%>
@@ -10,31 +10,31 @@ class <%= controller_class_name %>ControllerTest < ActionDispatch::IntegrationTe
end
test "should get index" do
- get url_for( controller: :<%= controller_name %>, action: :index )
+ get :index
assert_response :success
end
test "should create <%= singular_table_name %>" do
assert_difference('<%= class_name %>.count') do
- post url_for( controller: :<%= controller_name %>, action: :create, <%= "#{singular_table_name}: { #{attributes_hash} }" %> )
+ post :create, params: { <%= "#{singular_table_name}: { #{attributes_hash} }" %> }
end
assert_response 201
end
test "should show <%= singular_table_name %>" do
- get url_for( controller: :<%= controller_name %>, action: :show, id: <%= "@#{singular_table_name}" %> )
+ get :show, params: { id: <%= "@#{singular_table_name}" %> }
assert_response :success
end
test "should update <%= singular_table_name %>" do
- patch url_for( controller: :<%= controller_name %>, action: :update, id: <%= "@#{singular_table_name}" %>, <%= "#{singular_table_name}: { #{attributes_hash} }" %> )
+ patch :update, params: { id: <%= "@#{singular_table_name}" %>, <%= "#{singular_table_name}: { #{attributes_hash} }" %> }
assert_response 200
end
test "should destroy <%= singular_table_name %>" do
assert_difference('<%= class_name %>.count', -1) do
- delete url_for( controller: :<%= controller_name %>, action: :destroy, id: <%= "@#{singular_table_name}" %> )
+ delete :destroy, params: { id: <%= "@#{singular_table_name}" %> }
end
assert_response 204