diff options
author | Xavier Noria <fxn@hashref.com> | 2010-03-13 23:57:36 +0100 |
---|---|---|
committer | wycats <wycats@gmail.com> | 2010-03-13 17:04:08 -0600 |
commit | c8f1aac76196bdea8e1fe84a69f0b08c2372c533 (patch) | |
tree | 2d77cb0f936e8fdb8fa50421034d326eb7cdfedf | |
parent | 4ba334c0f4dac35b0c02cf3c4cca47d328283009 (diff) | |
download | rails-c8f1aac76196bdea8e1fe84a69f0b08c2372c533.tar.gz rails-c8f1aac76196bdea8e1fe84a69f0b08c2372c533.tar.bz2 rails-c8f1aac76196bdea8e1fe84a69f0b08c2372c533.zip |
restricts a test to < 1.9, and rewrites it using a proper expectation
Signed-off-by: wycats <wycats@gmail.com>
-rw-r--r-- | activerecord/test/cases/associations_test.rb | 16 | ||||
-rw-r--r-- | activerecord/test/cases/helper.rb | 1 |
2 files changed, 6 insertions, 11 deletions
diff --git a/activerecord/test/cases/associations_test.rb b/activerecord/test/cases/associations_test.rb index d0d646d460..d99fb44f01 100644 --- a/activerecord/test/cases/associations_test.rb +++ b/activerecord/test/cases/associations_test.rb @@ -180,17 +180,11 @@ class AssociationProxyTest < ActiveRecord::TestCase 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 diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index e831ebf36c..1fb59d3589 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -7,6 +7,7 @@ require 'config' require 'test/unit' require 'stringio' +require 'mocha' require 'active_record' require 'active_support/dependencies' |