diff options
Diffstat (limited to 'spec/arel/nodes/sql_literal_spec.rb')
-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 |