aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorRafael Chacón <rafaelchacon@gmail.com>2014-06-26 23:01:30 -0700
committerRafael Chacón <rafaelchacon@gmail.com>2014-06-26 23:01:30 -0700
commitc197a7dc418cd4fe07131a41a44c8ddb66258801 (patch)
treeb028e3418f8bf25c82ae2779b82f03636073411b /railties/test
parenta595fc1c56e5e9f4620bf5f248c87e9cb1e31b2f (diff)
downloadrails-c197a7dc418cd4fe07131a41a44c8ddb66258801.tar.gz
rails-c197a7dc418cd4fe07131a41a44c8ddb66258801.tar.bz2
rails-c197a7dc418cd4fe07131a41a44c8ddb66258801.zip
Add always_permitted_parameters as an option.
* This commit adds back the always_permitted_parameters configuration option to strong paramaters. * The initial pull requests where this feature was added are the following: - https://github.com/rails/rails/pull/12682 - https://github.com/rails/strong_parameters/pull/174
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/application/configuration_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb
index 03a735b1c1..95cab30de7 100644
--- a/railties/test/application/configuration_test.rb
+++ b/railties/test/application/configuration_test.rb
@@ -592,6 +592,19 @@ module ApplicationTests
assert_match "We're sorry, but something went wrong", last_response.body
end
+ test "config.action_controller.always_permitted_parameters are: controller, action by default" do
+ require "#{app_path}/config/environment"
+ assert_equal %w(controller action), ActionController::Parameters.always_permitted_parameters
+ end
+
+ test "config.action_controller.always_permitted_parameters = ['controller', 'action', 'format']" do
+ add_to_config <<-RUBY
+ config.action_controller.always_permitted_parameters = %w( controller action format )
+ RUBY
+ require "#{app_path}/config/environment"
+ assert_equal %w( controller action format ), ActionController::Parameters.always_permitted_parameters
+ end
+
test "config.action_controller.action_on_unpermitted_parameters is :log by default on development" do
ENV["RAILS_ENV"] = "development"