aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/generators/scaffold_controller_generator_test.rb
diff options
context:
space:
mode:
authorPrathamesh Sonpatki <csonpatki@gmail.com>2016-06-07 11:20:48 -0700
committerPrathamesh Sonpatki <csonpatki@gmail.com>2016-06-07 11:29:09 -0700
commitd68562e3c7ec8061c766ad8d5e189b5f460903c0 (patch)
tree4cb168898eef1ace7413854e0cad89ec25afd91a /railties/test/generators/scaffold_controller_generator_test.rb
parent1ffa9aa2846b1eed68b3cd01bc47a570e57c03e3 (diff)
downloadrails-d68562e3c7ec8061c766ad8d5e189b5f460903c0.tar.gz
rails-d68562e3c7ec8061c766ad8d5e189b5f460903c0.tar.bz2
rails-d68562e3c7ec8061c766ad8d5e189b5f460903c0.zip
Fix API controller tests by assigning them the encoding type
- Fixes #25183. - The `as: :json` feature was added in https://github.com/rails/rails/pull/21671 and recommended to use for JSON endpoints so let's use it by default for API controller tests.
Diffstat (limited to 'railties/test/generators/scaffold_controller_generator_test.rb')
-rw-r--r--railties/test/generators/scaffold_controller_generator_test.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/railties/test/generators/scaffold_controller_generator_test.rb b/railties/test/generators/scaffold_controller_generator_test.rb
index c37e289f4b..736ff0b41f 100644
--- a/railties/test/generators/scaffold_controller_generator_test.rb
+++ b/railties/test/generators/scaffold_controller_generator_test.rb
@@ -238,8 +238,8 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase
assert_file "test/controllers/users_controller_test.rb" do |content|
assert_match(/class UsersControllerTest < ActionDispatch::IntegrationTest/, content)
assert_match(/test "should get index"/, content)
- assert_match(/post users_url, params: \{ user: \{ age: @user\.age, name: @user\.name, organization_id: @user\.organization_id, organization_type: @user\.organization_type \} \}/, content)
- assert_match(/patch user_url\(@user\), params: \{ user: \{ age: @user\.age, name: @user\.name, organization_id: @user\.organization_id, organization_type: @user\.organization_type \} \}/, content)
+ assert_match(/post users_url, params: \{ user: \{ age: @user\.age, name: @user\.name, organization_id: @user\.organization_id, organization_type: @user\.organization_type \} \}, as: :json/, content)
+ assert_match(/patch user_url\(@user\), params: \{ user: \{ age: @user\.age, name: @user\.name, organization_id: @user\.organization_id, organization_type: @user\.organization_type \} \}, as: :json/, content)
assert_no_match(/assert_redirected_to/, content)
end
end