From 1c283765b603ffe57ebe924564b9e273f52bda14 Mon Sep 17 00:00:00 2001 From: kane Date: Wed, 8 Sep 2010 21:53:58 -0300 Subject: added a test for relation which checks intersection between a relation and an array works in both directions Signed-off-by: Mikel Lindsaar --- activerecord/test/cases/relations_test.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'activerecord') diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 9901f09f57..649fe79fd3 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -699,5 +699,11 @@ class RelationTest < ActiveRecord::TestCase assert_equal 'zyke', car.name end + def test_intersection_with_array + relation = Author.where(:name => "David") + rails_author = relation.first + assert_equal [rails_author], [rails_author] & relation + assert_equal [rails_author], relation & [rails_author] + end end -- cgit v1.2.3