blob: 01afb4bce433428c81f0f4139f7dbe1cdc641048 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
require 'test_helper'
describe Arel::Nodes::Count do
describe 'backwards compatibility' do
it 'must be an expression' do
Arel::Nodes::Count.new('foo').must_be_kind_of Arel::Expression
end
end
describe "as" do
it 'should alias the count' do
table = Arel::Table.new :users
table[:id].count.as('foo').to_sql.must_be_like %{
COUNT("users"."id") AS foo
}
end
end
end
|