Skip to content

Commit

Permalink
added a test for relation which checks intersection between a relatio…
Browse files Browse the repository at this point in the history
…n and an array works in both directions

Signed-off-by: Mikel Lindsaar <[email protected]>
  • Loading branch information
kane authored and mikel committed Sep 10, 2010
1 parent af2a011 commit 1c28376
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions activerecord/test/cases/relations_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -699,5 +699,11 @@ def test_order_using_scoping
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

0 comments on commit 1c28376

Please sign in to comment.