From e1ebe6e949ef3674434bfa90d271a7b74c2ac153 Mon Sep 17 00:00:00 2001 From: Ryan Davis Date: Mon, 18 Oct 2010 15:41:21 -0700 Subject: Fisting arel specs -- still needs tree_manager and cleanup --- test/nodes/test_count.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 test/nodes/test_count.rb (limited to 'test/nodes/test_count.rb') diff --git a/test/nodes/test_count.rb b/test/nodes/test_count.rb new file mode 100644 index 0000000000..d65df03313 --- /dev/null +++ b/test/nodes/test_count.rb @@ -0,0 +1,18 @@ +require 'spec_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 -- cgit v1.2.3