blob: c7ff1cf879a32c3caed65a5e127b142e767fd2f3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
require File.join(File.dirname(__FILE__), '..', '..', '..', '..', '..', 'spec_helper')
module Arel
describe SqlLiteral do
before do
@relation = Table.new(:users)
end
describe '#to_sql' do
it "manufactures sql with a literal SQL fragment" do
sql = @relation.project(Count.new(SqlLiteral.new("*"))).to_sql
adapter_is :mysql do
sql.should be_like(%Q{SELECT COUNT(*) AS count_id FROM `users`})
end
adapter_is_not :mysql do
sql.should be_like(%Q{SELECT COUNT(*) AS count_id FROM "users"})
end
end
end
end
end
|