aboutsummaryrefslogtreecommitdiffstats
path: root/test/nodes/test_sum.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/nodes/test_sum.rb')
-rw-r--r--test/nodes/test_sum.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/nodes/test_sum.rb b/test/nodes/test_sum.rb
new file mode 100644
index 0000000000..e6a57e4dd6
--- /dev/null
+++ b/test/nodes/test_sum.rb
@@ -0,0 +1,12 @@
+require 'spec_helper'
+
+describe Arel::Nodes::Sum do
+ describe "as" do
+ it 'should alias the sum' do
+ table = Arel::Table.new :users
+ table[:id].sum.as('foo').to_sql.must_be_like %{
+ SUM("users"."id") AS foo
+ }
+ end
+ end
+end