1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/test/nodes/test_sql_literal.rb

29 lines
706 B
Ruby
Raw Normal View History

require 'helper'
2010-08-23 13:14:02 -04:00
module Arel
module Nodes
describe 'sql literal' do
describe 'sql' do
it 'makes a sql literal node' do
sql = Arel.sql 'foo'
sql.must_be_kind_of Arel::Nodes::SqlLiteral
end
end
2010-08-23 13:14:02 -04:00
describe 'count' do
it 'makes a count node' do
node = SqlLiteral.new('*').count
viz = Visitors::ToSql.new Table.engine
viz.accept(node).must_be_like %{ COUNT(*) }
2010-08-23 13:14:02 -04:00
end
it 'makes a distinct node' do
node = SqlLiteral.new('*').count true
viz = Visitors::ToSql.new Table.engine
viz.accept(node).must_be_like %{ COUNT(DISTINCT *) }
2010-08-23 13:14:02 -04:00
end
end
end
end
end