From 7b9d71e99b1d78936d1e5de542b651efd4d882bf Mon Sep 17 00:00:00 2001 From: Leonel Galan Date: Mon, 6 Feb 2017 14:58:36 -0500 Subject: [PATCH 1/2] Fixes bug in Test::Schema when using filter_parameters --- lib/active_model_serializers/test/schema.rb | 4 ++-- test/active_model_serializers/test/schema_test.rb | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/active_model_serializers/test/schema.rb b/lib/active_model_serializers/test/schema.rb index 1f4dccc0..a0001586 100644 --- a/lib/active_model_serializers/test/schema.rb +++ b/lib/active_model_serializers/test/schema.rb @@ -60,11 +60,11 @@ module ActiveModelSerializers attr_reader :document_store def controller_path - request.filtered_parameters[:controller] + request.filtered_parameters.with_indifferent_access[:controller] end def action - request.filtered_parameters[:action] + request.filtered_parameters.with_indifferent_access[:action] end def schema_directory diff --git a/test/active_model_serializers/test/schema_test.rb b/test/active_model_serializers/test/schema_test.rb index 105ac575..2a465114 100644 --- a/test/active_model_serializers/test/schema_test.rb +++ b/test/active_model_serializers/test/schema_test.rb @@ -1,5 +1,7 @@ require 'test_helper' +Rails.application.config.filter_parameters += [:password] + module ActiveModelSerializers module Test class SchemaTest < ActionController::TestCase From e7c79b1f4983019c7eee38fd8546483a2e770a5d Mon Sep 17 00:00:00 2001 From: Leonel Galan Date: Mon, 6 Feb 2017 15:52:53 -0500 Subject: [PATCH 2/2] Move Rails.application.config into configure block for test rails app. --- test/active_model_serializers/test/schema_test.rb | 2 -- test/support/rails_app.rb | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/active_model_serializers/test/schema_test.rb b/test/active_model_serializers/test/schema_test.rb index 2a465114..105ac575 100644 --- a/test/active_model_serializers/test/schema_test.rb +++ b/test/active_model_serializers/test/schema_test.rb @@ -1,7 +1,5 @@ require 'test_helper' -Rails.application.config.filter_parameters += [:password] - module ActiveModelSerializers module Test class SchemaTest < ActionController::TestCase diff --git a/test/support/rails_app.rb b/test/support/rails_app.rb index 0bbae1fe..43324b78 100644 --- a/test/support/rails_app.rb +++ b/test/support/rails_app.rb @@ -6,6 +6,8 @@ module ActiveModelSerializers config.active_support.test_order = :random config.action_controller.perform_caching = true config.action_controller.cache_store = :memory_store + + config.filter_parameters += [:password] end app.routes.default_url_options = { host: 'example.com' }