aboutsummaryrefslogtreecommitdiffstats
path: root/spec/arel/integration/joins/with_adjacency_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/arel/integration/joins/with_adjacency_spec.rb')
-rw-r--r--spec/arel/integration/joins/with_adjacency_spec.rb18
1 files changed, 11 insertions, 7 deletions
diff --git a/spec/arel/integration/joins/with_adjacency_spec.rb b/spec/arel/integration/joins/with_adjacency_spec.rb
index ab63fecb46..222303977f 100644
--- a/spec/arel/integration/joins/with_adjacency_spec.rb
+++ b/spec/arel/integration/joins/with_adjacency_spec.rb
@@ -97,6 +97,17 @@ module Arel
.on(@predicate) \
.should disambiguate_attributes(@relation1[:id], @relation2[:id])
end
+
+ describe 'when both relations are compound and only one is an alias' do
+ it 'disambiguates the relation that serves as the ancestor to the attribute' do
+ compound1 = @relation1.select(@predicate)
+ compound2 = compound1.alias
+ compound1 \
+ .join(compound2) \
+ .on(@predicate) \
+ .should disambiguate_attributes(compound1[:id], compound2[:id])
+ end
+ end
describe 'when the left relation is extremely compound' do
it 'disambiguates the relation that serves as the ancestor to the attribute' do
@@ -107,13 +118,6 @@ module Arel
.on(@predicate) \
.should disambiguate_attributes(@relation1[:id], @relation2[:id])
end
-
- it '' do
- r0 = @relation1.select(@predicate)
- r1 = r0.alias
- r = r0.join(r1).on(@predicate)
- r.should disambiguate_attributes(r0[:id], r1[:id])
- end
end
describe 'when the right relation is extremely compound' do