aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-04-30 13:24:43 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-04-30 13:24:43 +0000
commit06f1895ac6237037a44d1f28058d5d1c05ba2d7f (patch)
tree14da1131eeb2613eed96b9182b8d514fb7e4b247 /activerecord
parent9ede45f60fd112c313840e707e1fdfebb5f6b97c (diff)
downloadrails-06f1895ac6237037a44d1f28058d5d1c05ba2d7f.tar.gz
rails-06f1895ac6237037a44d1f28058d5d1c05ba2d7f.tar.bz2
rails-06f1895ac6237037a44d1f28058d5d1c05ba2d7f.zip
A few more tests #1199
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1256 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord')
-rwxr-xr-xactiverecord/test/base_test.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/activerecord/test/base_test.rb b/activerecord/test/base_test.rb
index fa4364e019..1792cf799c 100755
--- a/activerecord/test/base_test.rb
+++ b/activerecord/test/base_test.rb
@@ -16,11 +16,15 @@ class LoosePerson < ActiveRecord::Base
attr_protected :credit_rating, :administrator
end
+class LooseDescendant < LoosePerson
+ attr_protected :phone_number
+end
+
class TightPerson < ActiveRecord::Base
attr_accessible :name, :address
end
-class TightDescendent < TightPerson
+class TightDescendant < TightPerson
attr_accessible :phone_number
end
@@ -463,8 +467,17 @@ class BasicsTest < Test::Unit::TestCase
end
def test_mass_assignment_protection_inheritance
+ assert_nil LoosePerson.accessible_attributes
assert_equal [ :credit_rating, :administrator ], LoosePerson.protected_attributes
+
+ assert_nil LooseDescendant.accessible_attributes
+ assert_equal [ :credit_rating, :administrator, :phone_number ], LooseDescendant.protected_attributes
+
assert_nil TightPerson.protected_attributes
+ assert_equal [ :name, :address ], TightPerson.accessible_attributes
+
+ assert_nil TightDescendant.protected_attributes
+ assert_equal [ :name, :address, :phone_number ], TightDescendant.accessible_attributes
end
def test_multiparameter_attributes_on_date