aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorkane <kane@raktefakt.net>2010-09-08 21:53:58 -0300
committerMikel Lindsaar <raasdnil@gmail.com>2010-09-10 21:13:57 +1000
commit1c283765b603ffe57ebe924564b9e273f52bda14 (patch)
tree0f5ddaa119a2c61502caeffd2d6c6754c369f210 /activerecord
parentaf2a011df2a29520ed55216c32dfb84b9f018b38 (diff)
downloadrails-1c283765b603ffe57ebe924564b9e273f52bda14.tar.gz
rails-1c283765b603ffe57ebe924564b9e273f52bda14.tar.bz2
rails-1c283765b603ffe57ebe924564b9e273f52bda14.zip
added a test for relation which checks intersection between a relation and an array works in both directions
Signed-off-by: Mikel Lindsaar <raasdnil@gmail.com>
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/relations_test.rb6
1 files changed, 6 insertions, 0 deletions
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