Permalink
Browse files

don't alter global state in test

  • Loading branch information...
1 parent 4e38082 commit 1c783c6040afd9a7ce0199e042e5c6549d0539b4 @jonleighton jonleighton committed Nov 30, 2011
Showing with 3 additions and 2 deletions.
  1. +3 −2 activerecord/test/cases/attribute_methods_test.rb
@@ -54,8 +54,9 @@ def test_attribute_present_with_booleans
end
def test_caching_nil_primary_key
- Minimalistic.expects(:reset_primary_key).returns(nil).once
- Minimalistic.create!
+ klass = Class.new(Minimalistic)
+ klass.expects(:reset_primary_key).returns(nil).once
+ 2.times { klass.primary_key }
end
def test_attribute_keys_on_new_instance

0 comments on commit 1c783c6

Please sign in to comment.