diff options
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/relation/where_clause_test.rb | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/activerecord/test/cases/relation/where_clause_test.rb b/activerecord/test/cases/relation/where_clause_test.rb index c20ed94d90..c3296b28fd 100644 --- a/activerecord/test/cases/relation/where_clause_test.rb +++ b/activerecord/test/cases/relation/where_clause_test.rb @@ -62,8 +62,21 @@ class ActiveRecord::Relation end test "merge allows for columns with the same name from different tables" do - skip "This is not possible as of 4.2, and the binds do not yet contain sufficient information for this to happen" - # We might be able to change the implementation to remove conflicts by index, rather than column name + table2 = Arel::Table.new("table2") + a = WhereClause.new( + [table["id"].eq(bind_param), table2["id"].eq(bind_param), table["name"].eq(bind_param)], + [attribute("id", 3), attribute("id", 2), attribute("name", "Jim")] + ) + b = WhereClause.new( + [table["id"].eq(bind_param), table["name"].eq(bind_param)], + [attribute("id", 1), attribute("name", "Sean")], + ) + expected = WhereClause.new( + [table2["id"].eq(bind_param), table["id"].eq(bind_param), table["name"].eq(bind_param)], + [attribute("id", 2), attribute("id", 1), attribute("name", "Sean")], + ) + + assert_equal expected, a.merge(b) end test "a clause knows if it is empty" do |