diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-08-23 10:14:02 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-08-23 10:14:02 -0700 |
commit | 2579fec805f23903dd6c4f1726198e010f5a9a54 (patch) | |
tree | 6dfbfbe4829a1a3f0c6e92e773d1f470bf111cf1 /spec/arel | |
parent | a3b8ef8375056cd3b6a8cea49dec671f2a8f6c41 (diff) | |
download | rails-2579fec805f23903dd6c4f1726198e010f5a9a54.tar.gz rails-2579fec805f23903dd6c4f1726198e010f5a9a54.tar.bz2 rails-2579fec805f23903dd6c4f1726198e010f5a9a54.zip |
adding count nodes
Diffstat (limited to 'spec/arel')
-rw-r--r-- | spec/arel/nodes/sql_literal_spec.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/arel/nodes/sql_literal_spec.rb b/spec/arel/nodes/sql_literal_spec.rb new file mode 100644 index 0000000000..390eb708e1 --- /dev/null +++ b/spec/arel/nodes/sql_literal_spec.rb @@ -0,0 +1,19 @@ +module Arel + module Nodes + describe 'sql literal' do + describe 'count' do + it 'makes a count node' do + node = SqlLiteral.new('*').count + viz = Visitors::ToSql.new Table.engine + viz.accept(node).should be_like %{ COUNT(*) } + end + + it 'makes a distinct node' do + node = SqlLiteral.new('*').count true + viz = Visitors::ToSql.new Table.engine + viz.accept(node).should be_like %{ COUNT(DISTINCT *) } + end + end + end + end +end |