aboutsummaryrefslogtreecommitdiffstats
path: root/test/nodes
diff options
context:
space:
mode:
authorAlexander Staubo <alex@origo.no>2012-02-23 14:16:44 +0100
committerAlexander Staubo <alex@origo.no>2012-02-23 14:16:44 +0100
commit74aadecc4f58e73704ac6a6fdaf25e48832374cf (patch)
tree0ca4d7ee6bc92f0337d894e2fcc844947d5d2c3d /test/nodes
parent2db4ec6a28a59a3f74a4979ae5bc117e5c7573c4 (diff)
downloadrails-74aadecc4f58e73704ac6a6fdaf25e48832374cf.tar.gz
rails-74aadecc4f58e73704ac6a6fdaf25e48832374cf.tar.bz2
rails-74aadecc4f58e73704ac6a6fdaf25e48832374cf.zip
Must support aliases for OVER operator.
Diffstat (limited to 'test/nodes')
-rw-r--r--test/nodes/test_over.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/nodes/test_over.rb b/test/nodes/test_over.rb
index fcc5078e7b..0bdd665e56 100644
--- a/test/nodes/test_over.rb
+++ b/test/nodes/test_over.rb
@@ -1,6 +1,15 @@
require 'helper'
describe Arel::Nodes::Over do
+ describe 'as' do
+ it 'should alias the expression' do
+ table = Arel::Table.new :users
+ table[:id].count.over.as('foo').to_sql.must_be_like %{
+ COUNT("users"."id") OVER () AS foo
+ }
+ end
+ end
+
describe 'with literal' do
it 'should reference the window definition by name' do
table = Arel::Table.new :users