diff options
author | Max Holder <mxhold@gmail.com> | 2014-08-30 13:58:18 -0400 |
---|---|---|
committer | Max Holder <mxhold@gmail.com> | 2014-08-30 13:58:18 -0400 |
commit | 112cb940aa17a0979b9f6282c07ace2f6a0896c1 (patch) | |
tree | 9a0f95749fbcebb1ad711f4ccfcc44f1472f55c7 /test | |
parent | 36836fa5e7c084c0dce2818577e6fd0cf815f786 (diff) | |
download | rails-112cb940aa17a0979b9f6282c07ace2f6a0896c1.tar.gz rails-112cb940aa17a0979b9f6282c07ace2f6a0896c1.tar.bz2 rails-112cb940aa17a0979b9f6282c07ace2f6a0896c1.zip |
Add SelectManager#distinct_on to set/unset Arel::Nodes::DistinctOn quantifier
Diffstat (limited to 'test')
-rw-r--r-- | test/test_select_manager.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/test_select_manager.rb b/test/test_select_manager.rb index 3380bbec6f..1ffb56fd9f 100644 --- a/test/test_select_manager.rb +++ b/test/test_select_manager.rb @@ -1158,5 +1158,26 @@ module Arel manager.distinct(false).must_equal manager end end + + describe 'distinct_on' do + it 'sets the quantifier' do + manager = Arel::SelectManager.new Table.engine + table = Table.new :users + + manager.distinct_on(table['id']) + manager.ast.cores.last.set_quantifier.must_equal Arel::Nodes::DistinctOn.new(table['id']) + + manager.distinct_on(false) + manager.ast.cores.last.set_quantifier.must_equal nil + end + + it "chains" do + manager = Arel::SelectManager.new Table.engine + table = Table.new :users + + manager.distinct_on(table['id']).must_equal manager + manager.distinct_on(false).must_equal manager + end + end end end |