aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application
diff options
context:
space:
mode:
authorJosh Kalderimis <josh.kalderimis@gmail.com>2011-04-24 00:54:48 +0200
committerJosh Kalderimis <josh.kalderimis@gmail.com>2011-04-24 09:58:12 +0200
commitf3b9d3aba8cc0ffaca2da1c73c4ba96de2066760 (patch)
treed86a4e2e8829d54b5ce53d5965e6433806b72064 /railties/test/application
parentb3ba36830b7c8154cbe11a3fe4a2b2574b228819 (diff)
downloadrails-f3b9d3aba8cc0ffaca2da1c73c4ba96de2066760.tar.gz
rails-f3b9d3aba8cc0ffaca2da1c73c4ba96de2066760.tar.bz2
rails-f3b9d3aba8cc0ffaca2da1c73c4ba96de2066760.zip
added config.active_record.whitelist_attributes which creates an empty whitelist of attributes available for mass assignment for all models in your app
Diffstat (limited to 'railties/test/application')
-rw-r--r--railties/test/application/configuration_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb
index 62697b1bf9..ab3eb4c9e7 100644
--- a/railties/test/application/configuration_test.rb
+++ b/railties/test/application/configuration_test.rb
@@ -258,6 +258,18 @@ module ApplicationTests
assert_equal res, last_response.body # value should be unchanged
end
+ test "sets all Active Record models to whitelist all attributes by default" do
+ add_to_config <<-RUBY
+ config.active_record.whitelist_attributes = true
+ RUBY
+
+ require "#{app_path}/config/environment"
+
+ assert_equal ActiveModel::MassAssignmentSecurity::WhiteList,
+ ActiveRecord::Base.active_authorizers[:default].class
+ assert_equal [""], ActiveRecord::Base.active_authorizers[:default].to_a
+ end
+
test "registers interceptors with ActionMailer" do
add_to_config <<-RUBY
config.action_mailer.interceptors = MyMailInterceptor