diff options
author | Stephen Prater & Fire-Dragon-DoL <francesco.belladonna@gmail.com> | 2013-07-31 01:08:22 +0200 |
---|---|---|
committer | Stephen Prater <me@stephenprater.com> | 2014-03-30 22:59:16 -0500 |
commit | 4cb02380116b102142f85d92b7923c11882f94c7 (patch) | |
tree | 3cfb5968941e8979ebdfe12c2884398b65f7c8b6 /test/visitors | |
parent | dbe1f8b29a80bf07aa5df624f68b9de869c1f248 (diff) | |
download | rails-4cb02380116b102142f85d92b7923c11882f94c7.tar.gz rails-4cb02380116b102142f85d92b7923c11882f94c7.tar.bz2 rails-4cb02380116b102142f85d92b7923c11882f94c7.zip |
Added right and full outer joins
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 |