Permalink
Browse files

restricts a test to < 1.9, and rewrites it using a proper expectation

Signed-off-by: wycats <wycats@gmail.com>
  • Loading branch information...
fxn authored and wycats committed Mar 13, 2010
1 parent 4ba334c commit c8f1aac76196bdea8e1fe84a69f0b08c2372c533
Showing with 6 additions and 11 deletions.
  1. +5 −11 activerecord/test/cases/associations_test.rb
  2. +1 −0 activerecord/test/cases/helper.rb
@@ -180,17 +180,11 @@ def test_reload_returns_assocition
end
end
- def test_splat_does_not_invoke_to_a_on_singular_targets
- Kernel.module_eval do
- alias original_to_a to_a
- def to_a
- [:_]
- end
- end
- assert_not_equal [:_], [*posts(:welcome).author]
- ensure
- Kernel.module_eval do
- alias to_a original_to_a
+ if RUBY_VERSION < '1.9'
+ def test_splat_does_not_invoke_to_a_on_singular_targets
+ author = posts(:welcome).author
+ author.reload.target.expects(:to_a).never
+ [*author]
end
end
@@ -7,6 +7,7 @@
require 'test/unit'
require 'stringio'
+require 'mocha'
require 'active_record'
require 'active_support/dependencies'

0 comments on commit c8f1aac

Please sign in to comment.