diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-04-21 15:46:24 -0500 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-04-21 15:46:24 -0500 |
commit | 0b9af9762a5f3431f83a9bba6919fef9346e310a (patch) | |
tree | 7731a00a00ff0588835fe2e7f7164be0a4264116 /test/visitors | |
parent | cae83ce964b9919b890bb7fa6f920a536e6b5425 (diff) | |
download | rails-0b9af9762a5f3431f83a9bba6919fef9346e310a.tar.gz rails-0b9af9762a5f3431f83a9bba6919fef9346e310a.tar.bz2 rails-0b9af9762a5f3431f83a9bba6919fef9346e310a.zip |
adding Distinct ON node
Diffstat (limited to 'test/visitors')
-rw-r--r-- | test/visitors/test_oracle.rb | 4 | ||||
-rw-r--r-- | test/visitors/test_postgres.rb | 11 |
2 files changed, 13 insertions, 2 deletions
diff --git a/test/visitors/test_oracle.rb b/test/visitors/test_oracle.rb index 87b94409e3..eaf68013a7 100644 --- a/test/visitors/test_oracle.rb +++ b/test/visitors/test_oracle.rb @@ -101,7 +101,7 @@ module Arel sql.must_be_like %{ SELECT * FROM ( SELECT raw_sql_.*, rownum raw_rnum_ - FROM (SELECT ) raw_sql_ + FROM (SELECT) raw_sql_ WHERE rownum <= 20 ) WHERE raw_rnum_ > 10 @@ -126,7 +126,7 @@ module Arel sql.must_be_like %{ SELECT * FROM ( SELECT raw_sql_.*, rownum raw_rnum_ - FROM (SELECT ) raw_sql_ + FROM (SELECT) raw_sql_ ) WHERE raw_rnum_ > 10 } diff --git a/test/visitors/test_postgres.rb b/test/visitors/test_postgres.rb index 74446c23ba..446eae0c4a 100644 --- a/test/visitors/test_postgres.rb +++ b/test/visitors/test_postgres.rb @@ -32,6 +32,17 @@ module Arel assert_equal 1, sql.scan(/LIMIT/).length, 'should have one limit' end + it 'should support DISTINCT ON' do + core = Arel::Nodes::SelectCore.new + core.set_quantifier = Arel::Nodes::DistinctOn.new(Arel.sql('aaron')) + assert_match 'DISTINCT ON ( aaron )', @visitor.accept(core) + end + + it 'should support DISTINCT' do + core = Arel::Nodes::SelectCore.new + core.set_quantifier = Arel::Nodes::Distinct.new + assert_equal 'SELECT DISTINCT', @visitor.accept(core) + end end end end |