diff options
author | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-05-18 22:11:05 -0700 |
---|---|---|
committer | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-05-18 22:11:05 -0700 |
commit | 14210279b23788d47a18f0615f5e20234550c8ac (patch) | |
tree | a618279edd1e58b61cb44e213bf6937e5b47ba01 /spec/arel/unit | |
parent | 7feff4e7b52fbef356426d22257af161704315ad (diff) | |
download | rails-14210279b23788d47a18f0615f5e20234550c8ac.tar.gz rails-14210279b23788d47a18f0615f5e20234550c8ac.tar.bz2 rails-14210279b23788d47a18f0615f5e20234550c8ac.zip |
can't remember what i was working on
Diffstat (limited to 'spec/arel/unit')
-rw-r--r-- | spec/arel/unit/relations/alias_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/arel/unit/relations/alias_spec.rb b/spec/arel/unit/relations/alias_spec.rb index 96e06f48bc..ce35debadf 100644 --- a/spec/arel/unit/relations/alias_spec.rb +++ b/spec/arel/unit/relations/alias_spec.rb @@ -12,5 +12,25 @@ module Arel (aliaz = Alias.new(@relation)).should == aliaz end end + + describe '#to_sql' do + describe 'when there is no ambiguity' do + it 'does not alias table names anywhere a table name can appear' do + @relation \ + .select(@relation[:id].eq(1)) \ + .order(@relation[:id]) \ + .project(@relation[:id]) \ + .group(@relation[:id]) \ + .alias \ + .to_sql.should be_like(" + SELECT `users`.`id` + FROM `users` + WHERE `users`.`id` = 1 + ORDER BY `users`.`id` + GROUP BY `users`.`id` + ") + end + end + end end end
\ No newline at end of file |