diff options
Diffstat (limited to 'test/visitors')
-rw-r--r-- | test/visitors/test_depth_first.rb | 12 | ||||
-rw-r--r-- | test/visitors/test_join_sql.rb | 26 |
2 files changed, 38 insertions, 0 deletions
diff --git a/test/visitors/test_depth_first.rb b/test/visitors/test_depth_first.rb index cbaa780dae..baa8f64184 100644 --- a/test/visitors/test_depth_first.rb +++ b/test/visitors/test_depth_first.rb @@ -81,12 +81,24 @@ module Arel assert_equal [:a, :b, join], @collector.calls end + def test_full_outer_join + join = Nodes::FullOuterJoin.new :a, :b + @visitor.accept join + assert_equal [:a, :b, join], @collector.calls + end + def test_outer_join join = Nodes::OuterJoin.new :a, :b @visitor.accept join assert_equal [:a, :b, join], @collector.calls end + def test_right_outer_join + join = Nodes::RightOuterJoin.new :a, :b + @visitor.accept join + assert_equal [:a, :b, join], @collector.calls + end + [ Arel::Nodes::Assignment, Arel::Nodes::Between, diff --git a/test/visitors/test_join_sql.rb b/test/visitors/test_join_sql.rb index ea71c05d79..34378dafe7 100644 --- a/test/visitors/test_join_sql.rb +++ b/test/visitors/test_join_sql.rb @@ -25,6 +25,19 @@ module Arel end end + describe 'FULL outer join' do + it 'should visit left if left is a join' do + t = Table.new :users + sm = t.select_manager + sm.join(t, Nodes::FullOuterJoin).on(t[:id]).join( + t, Nodes::FullOuterJoin).on(t[:id]) + sm.join_sql.must_be_like %{ + FULL OUTER JOIN "users" ON "users"."id" + FULL OUTER JOIN "users" ON "users"."id" + } + end + end + describe 'outer join' do it 'should visit left if left is a join' do t = Table.new :users @@ -37,6 +50,19 @@ module Arel } end end + + describe 'right outer join' do + it 'should visit left if left is a join' do + t = Table.new :users + sm = t.select_manager + sm.join(t, Nodes::RightOuterJoin).on(t[:id]).join( + t, Nodes::RightOuterJoin).on(t[:id]) + sm.join_sql.must_be_like %{ + RIGHT OUTER JOIN "users" ON "users"."id" + RIGHT OUTER JOIN "users" ON "users"."id" + } + end + end end end end |