Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix ActiveModel tests that depend on run order

  • Loading branch information...
commit 961957d5709b6e18a0c6adf0b4783297cc21140a 1 parent cc14a3b
@frodsan frodsan authored
Showing with 4 additions and 6 deletions.
  1. +4 −6 activemodel/test/cases/mass_assignment_security_test.rb
View
10 activemodel/test/cases/mass_assignment_security_test.rb
@@ -11,7 +11,6 @@ def process_removed_attributes(klass, attrs)
end
class MassAssignmentSecurityTest < ActiveModel::TestCase
-
def test_attribute_protection
user = User.new
expected = { "name" => "John Smith", "email" => "john@smith.com" }
@@ -96,7 +95,6 @@ def test_mass_assignment_protection_inheritance
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 @@ def test_mass_assignment_multiparameter_protector
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
Please sign in to comment.
Something went wrong with that request. Please try again.