From c1232b9fd304dd6fd2349bb6c85a65a18f828338 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Fri, 12 Mar 2010 22:19:10 +0100 Subject: [PATCH] adds coverage for the issue addressed in fe43bbd --- activerecord/test/cases/associations_test.rb | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/activerecord/test/cases/associations_test.rb b/activerecord/test/cases/associations_test.rb index 9bc34bd..d0d646d 100644 --- a/activerecord/test/cases/associations_test.rb +++ b/activerecord/test/cases/associations_test.rb @@ -180,6 +180,20 @@ 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 + end + end + def setup_dangling_association josh = Author.create(:name => "Josh") p = Post.create(:title => "New on Edge", :body => "More cool stuff!", :author => josh) -- 1.6.6