aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/base_test.rb
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2007-01-28 01:31:31 +0000
committerRick Olson <technoweenie@gmail.com>2007-01-28 01:31:31 +0000
commit1a11bffde107bf5b2daa997a61133cc8a76445e0 (patch)
tree5f4571e9c4020654828df26174f23e11fcd8d934 /activerecord/test/base_test.rb
parent5e85a1c7f835249d276d6868a9520f803be46159 (diff)
downloadrails-1a11bffde107bf5b2daa997a61133cc8a76445e0.tar.gz
rails-1a11bffde107bf5b2daa997a61133cc8a76445e0.tar.bz2
rails-1a11bffde107bf5b2daa997a61133cc8a76445e0.zip
Don't create instance writer methods for class attributes. Closes #7401 [Rick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6051 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/base_test.rb')
-rwxr-xr-xactiverecord/test/base_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/base_test.rb b/activerecord/test/base_test.rb
index e1dd5704db..95c758f805 100755
--- a/activerecord/test/base_test.rb
+++ b/activerecord/test/base_test.rb
@@ -748,6 +748,16 @@ class BasicsTest < Test::Unit::TestCase
firm.attributes = { "name" => "Next Angle", "rating" => 5 }
assert_equal 1, firm.rating
end
+
+ def test_mass_assignment_protection_against_class_attribute_writers
+ [:logger, :configurations, :primary_key_prefix_type, :table_name_prefix, :table_name_suffix, :pluralize_table_names, :colorize_logging,
+ :default_timezone, :allow_concurrency, :generate_read_methods, :schema_format, :verification_timeout, :lock_optimistically, :record_timestamps].each do |method|
+ assert Task.respond_to?(method)
+ assert Task.respond_to?("#{method}=")
+ assert Task.new.respond_to?(method)
+ assert !Task.new.respond_to?("#{method}=")
+ end
+ end
def test_customized_primary_key_remains_protected
subscriber = Subscriber.new(:nick => 'webster123', :name => 'nice try')