aboutsummaryrefslogtreecommitdiffstats
path: root/spec/arel/unit/relations/join_spec.rb
diff options
context:
space:
mode:
authorNick Kallen <nkallen@nick-kallens-computer-2.local>2008-04-30 23:42:26 -0700
committerNick Kallen <nkallen@nick-kallens-computer-2.local>2008-04-30 23:42:26 -0700
commitf48c642852b5bb6be62dbbc7502d34b64e53716b (patch)
tree50b65f7ff7253201924336fa65eb6481df913f84 /spec/arel/unit/relations/join_spec.rb
parent57d6bce28b07f864c97a7b58d758fd5621196b00 (diff)
downloadrails-f48c642852b5bb6be62dbbc7502d34b64e53716b.tar.gz
rails-f48c642852b5bb6be62dbbc7502d34b64e53716b.tar.bz2
rails-f48c642852b5bb6be62dbbc7502d34b64e53716b.zip
the big obstacle
Diffstat (limited to 'spec/arel/unit/relations/join_spec.rb')
-rw-r--r--spec/arel/unit/relations/join_spec.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/spec/arel/unit/relations/join_spec.rb b/spec/arel/unit/relations/join_spec.rb
index b14d951aae..c3f33e1ae7 100644
--- a/spec/arel/unit/relations/join_spec.rb
+++ b/spec/arel/unit/relations/join_spec.rb
@@ -129,7 +129,7 @@ module Arel
describe 'when joining a relation to itself' do
before do
- @aliased_relation = @relation1.as(:alias)
+ @aliased_relation = @relation1.alias
@predicate = @relation1[:id].eq(@aliased_relation[:id])
end
@@ -145,6 +145,13 @@ module Arel
describe 'when joining the same relation to itself' do
describe '#to_sql' do
+ it '' do
+ @relation1 \
+ .join(@relation1.alias.join(@relation1.alias).on(@relation1[:id].eq(1))) \
+ .on(@relation1[:id].eq(1)) \
+ .to_sql.should be_like("")
+ end
+
it 'aliases the table and attributes properly in the join predicate and the where clause' do
@relation1.join(@aliased_relation).on(@relation1[:id].eq(@aliased_relation[:id])).to_sql.should be_like("
SELECT `users`.`id`, `users`.`name`, `users_2`.`id`, `users_2`.`name`
@@ -173,7 +180,7 @@ module Arel
SELECT `users`.`id`, `users`.`name`
FROM `users`
INNER JOIN asdf ON fdsa
- ")
+ ")
end
end
end