From 6064001d642fdbd18cdfe2aafc1f17e8fb248bd1 Mon Sep 17 00:00:00 2001 From: Nick Kallen Date: Fri, 16 May 2008 14:43:27 -0700 Subject: additional test coverage for some random complex case --- spec/arel/integration/joins/with_adjacency_spec.rb | 25 ++++++++++++++++++++++ spec/arel/unit/primitives/expression_spec.rb | 1 + 2 files changed, 26 insertions(+) (limited to 'spec/arel') diff --git a/spec/arel/integration/joins/with_adjacency_spec.rb b/spec/arel/integration/joins/with_adjacency_spec.rb index 74d461319c..56ead0993a 100644 --- a/spec/arel/integration/joins/with_adjacency_spec.rb +++ b/spec/arel/integration/joins/with_adjacency_spec.rb @@ -96,6 +96,31 @@ module Arel relation[@relation1[:id]].ancestor.should == @relation1[:id] relation[@relation2[:id]].ancestor.should == @relation2[:id] end + + describe 'when the left relation is compound' do + it '' do + relation = @relation1 \ + .select(@predicate) \ + .select(@predicate) \ + .join(@relation2) \ + .on(@predicate) + relation[@relation1[:id]].should be_descends_from(@relation1[:id]) + relation[@relation1[:id]].should_not be_descends_from(@relation2[:id]) + end + end + + describe 'when the right relation is compound' do + it '' do + relation = @relation1 \ + .join( \ + @relation2 \ + .select(@predicate) \ + .select(@predicate) \ + .select(@predicate)) \ + .on(@predicate) + relation[@relation2[:id]].should be_descends_from(@relation2[:id]) + end + end end end end diff --git a/spec/arel/unit/primitives/expression_spec.rb b/spec/arel/unit/primitives/expression_spec.rb index 8a990231f6..ace439b952 100644 --- a/spec/arel/unit/primitives/expression_spec.rb +++ b/spec/arel/unit/primitives/expression_spec.rb @@ -14,6 +14,7 @@ module Arel describe '#bind' do it "manufactures an attribute with a rebound relation and self as the ancestor" do + pending derived_relation = @relation.select(@relation[:id].eq(1)) @expression.bind(derived_relation).should == Expression.new(@attribute.bind(derived_relation), "COUNT", nil, @expression) end -- cgit v1.2.3