aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-08-24 08:56:16 -0700
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-08-24 08:56:16 -0700
commit2c571b3f0544a6457db4818e752f4cd4bacd48b4 (patch)
treea7dae21847d456a9ac713c4b93de0546201a6100 /activemodel/test
parent6a70f2dd6b791c3f4888122d5b7dd9c8f5cac871 (diff)
parent73f0afd1d41aa6c3febcc2e93e4d19d9bf0f27dc (diff)
downloadrails-2c571b3f0544a6457db4818e752f4cd4bacd48b4.tar.gz
rails-2c571b3f0544a6457db4818e752f4cd4bacd48b4.tar.bz2
rails-2c571b3f0544a6457db4818e752f4cd4bacd48b4.zip
Merge pull request #7058 from frodsan/fix_as_random_tests
Fix tests that depend on run order
Diffstat (limited to 'activemodel/test')
-rw-r--r--activemodel/test/cases/mass_assignment_security_test.rb10
1 files changed, 4 insertions, 6 deletions
diff --git a/activemodel/test/cases/mass_assignment_security_test.rb b/activemodel/test/cases/mass_assignment_security_test.rb
index 0c6352cd71..45757615f5 100644
--- a/activemodel/test/cases/mass_assignment_security_test.rb
+++ b/activemodel/test/cases/mass_assignment_security_test.rb
@@ -11,7 +11,6 @@ class CustomSanitizer < ActiveModel::MassAssignmentSecurity::Sanitizer
end
class MassAssignmentSecurityTest < ActiveModel::TestCase
-
def test_attribute_protection
user = User.new
expected = { "name" => "John Smith", "email" => "john@smith.com" }
@@ -96,7 +95,6 @@ class MassAssignmentSecurityTest < ActiveModel::TestCase
assert_blank TightDescendant.protected_attributes(:admin) - TightDescendant.attributes_protected_by_default
assert_equal Set.new(['name', 'address', 'admin', 'super_powers']), TightDescendant.accessible_attributes(:admin)
-
end
def test_mass_assignment_multiparameter_protector
@@ -107,14 +105,14 @@ class MassAssignmentSecurityTest < ActiveModel::TestCase
end
def test_custom_sanitizer
+ old_sanitizer = User._mass_assignment_sanitizer
+
user = User.new
User.mass_assignment_sanitizer = CustomSanitizer.new
assert_raise StandardError do
user.sanitize_for_mass_assignment("admin" => true)
end
ensure
- User.mass_assignment_sanitizer = nil
-
+ User.mass_assignment_sanitizer = old_sanitizer
end
-
-end
+end \ No newline at end of file