aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test')
-rwxr-xr-xactiverecord/test/base_test.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/activerecord/test/base_test.rb b/activerecord/test/base_test.rb
index 53ef4a5e86..650d87f91f 100755
--- a/activerecord/test/base_test.rb
+++ b/activerecord/test/base_test.rb
@@ -67,6 +67,13 @@ end
class BasicsTest < Test::Unit::TestCase
fixtures :topics, :companies, :developers, :projects, :computers, :accounts, :minimalistics
+ # whiny_protected_attributes is turned off since several tests were
+ # not written with it in mind, and would otherwise raise exceptions
+ # as an irrelevant side-effect.
+ def setup
+ ActiveRecord::Base.whiny_protected_attributes = false
+ end
+
def test_table_exists
assert !NonExistentTable.table_exists?
assert Topic.table_exists?
@@ -860,6 +867,17 @@ class BasicsTest < Test::Unit::TestCase
assert_equal [ :name, :address, :phone_number ], TightDescendant.accessible_attributes
end
+ def test_whiny_protected_attributes
+ ActiveRecord::Base.whiny_protected_attributes = true
+ assert_raise(ActiveRecord::ProtectedAttributeAssignmentError) do
+ LoosePerson.create!(:administrator => true)
+ end
+ ActiveRecord::Base.whiny_protected_attributes = false
+ assert_nothing_raised do
+ LoosePerson.create!(:administrator => true)
+ end
+ end
+
def test_readonly_attributes
assert_equal [ :title ], ReadonlyTitlePost.readonly_attributes