diff options
author | Francesco Rodriguez <lrodriguezsanc@gmail.com> | 2012-07-14 16:26:05 -0500 |
---|---|---|
committer | Francesco Rodriguez <lrodriguezsanc@gmail.com> | 2012-08-23 16:00:58 -0500 |
commit | 961957d5709b6e18a0c6adf0b4783297cc21140a (patch) | |
tree | 542868961fc5000cee08b15f884aa627bea18e22 /activemodel/test | |
parent | cc14a3b2c1d5684c88355230faa263515358776d (diff) | |
download | rails-961957d5709b6e18a0c6adf0b4783297cc21140a.tar.gz rails-961957d5709b6e18a0c6adf0b4783297cc21140a.tar.bz2 rails-961957d5709b6e18a0c6adf0b4783297cc21140a.zip |
Fix ActiveModel tests that depend on run order
Diffstat (limited to 'activemodel/test')
-rw-r--r-- | activemodel/test/cases/mass_assignment_security_test.rb | 10 |
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 |