Skip to content
This repository
Browse code

added a test for relation which checks intersection between a relatio…

…n and an array works in both directions

Signed-off-by: Mikel Lindsaar <raasdnil@gmail.com>
  • Loading branch information...
commit 1c283765b603ffe57ebe924564b9e273f52bda14 1 parent af2a011
authored mikel committed

Showing 1 changed file with 6 additions and 0 deletions. Show diff stats Hide diff stats

  1. 6  activerecord/test/cases/relations_test.rb
6  activerecord/test/cases/relations_test.rb
@@ -699,5 +699,11 @@ def test_order_using_scoping
699 699
     assert_equal 'zyke', car.name
700 700
   end
701 701
 
  702
+  def test_intersection_with_array
  703
+    relation = Author.where(:name => "David")
  704
+    rails_author = relation.first
702 705
 
  706
+    assert_equal [rails_author], [rails_author] & relation
  707
+    assert_equal [rails_author], relation & [rails_author]
  708
+  end
703 709
 end

0 notes on commit 1c28376

Please sign in to comment.
Something went wrong with that request. Please try again.