diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/active_relation/predicates/binary_spec.rb | 9 | ||||
-rw-r--r-- | spec/active_relation/relations/join_spec.rb | 3 | ||||
-rw-r--r-- | spec/active_relation/relations/order_spec.rb | 11 | ||||
-rw-r--r-- | spec/active_relation/relations/projection_spec.rb | 9 | ||||
-rw-r--r-- | spec/active_relation/relations/range_spec.rb | 10 | ||||
-rw-r--r-- | spec/active_relation/relations/rename_spec.rb | 13 | ||||
-rw-r--r-- | spec/active_relation/relations/selection_spec.rb | 11 |
7 files changed, 53 insertions, 13 deletions
diff --git a/spec/active_relation/predicates/binary_spec.rb b/spec/active_relation/predicates/binary_spec.rb index 89a40d2bf3..4f37a6aa7e 100644 --- a/spec/active_relation/predicates/binary_spec.rb +++ b/spec/active_relation/predicates/binary_spec.rb @@ -27,8 +27,15 @@ module ActiveRelation end describe '#qualify' do + it "descends" do + ConcreteBinary.new(@attribute1, @attribute2).qualify \ + .should == ConcreteBinary.new(@attribute1, @attribute2).descend(&:qualify) + end + end + + describe '#descend' do it "distributes over the predicates and attributes" do - ConcreteBinary.new(@attribute1, @attribute2).qualify. \ + ConcreteBinary.new(@attribute1, @attribute2).descend(&:qualify). \ should == ConcreteBinary.new(@attribute1.qualify, @attribute2.qualify) end end diff --git a/spec/active_relation/relations/join_spec.rb b/spec/active_relation/relations/join_spec.rb index b60238fa7e..77c6baeac4 100644 --- a/spec/active_relation/relations/join_spec.rb +++ b/spec/active_relation/relations/join_spec.rb @@ -25,14 +25,13 @@ module ActiveRelation end end - describe '#qualify' do + describe '#descend' do it 'distributes over the relations and predicates' do Join.new("INNER JOIN", @relation1, @relation2, @predicate).qualify. \ should == Join.new("INNER JOIN", @relation1.qualify, @relation2.qualify, @predicate.qualify) end end - describe '#prefix_for' do it 'needs a test' do pending diff --git a/spec/active_relation/relations/order_spec.rb b/spec/active_relation/relations/order_spec.rb index 12b9761431..32a54e72fa 100644 --- a/spec/active_relation/relations/order_spec.rb +++ b/spec/active_relation/relations/order_spec.rb @@ -8,9 +8,16 @@ module ActiveRelation end describe '#qualify' do - it "distributes over the relation and attributes" do + it "descends" do Order.new(@relation, @attribute).qualify. \ - should == Order.new(@relation.qualify, @attribute.qualify) + should == Order.new(@relation, @attribute).descend(&:qualify) + end + end + + describe '#descend' do + it "distributes over the relation and attributes" do + Order.new(@relation, @attribute).descend(&:qualify). \ + should == Order.new(@relation.descend(&:qualify), @attribute.qualify) end end diff --git a/spec/active_relation/relations/projection_spec.rb b/spec/active_relation/relations/projection_spec.rb index 2bc4ed1d6e..9f6b6797ce 100644 --- a/spec/active_relation/relations/projection_spec.rb +++ b/spec/active_relation/relations/projection_spec.rb @@ -33,7 +33,14 @@ module ActiveRelation describe '#qualify' do it "distributes over the relation and attributes" do Projection.new(@relation, @attribute).qualify. \ - should == Projection.new(@relation.qualify, @attribute.qualify) + should == Projection.new(@relation, @attribute).descend(&:qualify) + end + end + + describe '#descend' do + it "distributes over the relation and attributes" do + Projection.new(@relation, @attribute).descend(&:qualify). \ + should == Projection.new(@relation.descend(&:qualify), @attribute.qualify) end end diff --git a/spec/active_relation/relations/range_spec.rb b/spec/active_relation/relations/range_spec.rb index a2f84c2e88..f27b6106e8 100644 --- a/spec/active_relation/relations/range_spec.rb +++ b/spec/active_relation/relations/range_spec.rb @@ -8,11 +8,17 @@ module ActiveRelation end describe '#qualify' do + it "descends" do + Range.new(@relation, @range).qualify.should == Range.new(@relation, @range).descend(&:qualify) + end + end + + describe '#descend' do it "distributes over the relation" do - Range.new(@relation, @range).qualify.should == Range.new(@relation.qualify, @range) + Range.new(@relation, @range).descend(&:qualify).should == Range.new(@relation.descend(&:qualify), @range) end end - + describe '#to_sql' do it "manufactures sql with limit and offset" do range_size = @range.last - @range.first + 1 diff --git a/spec/active_relation/relations/rename_spec.rb b/spec/active_relation/relations/rename_spec.rb index deb538615b..6c6bd450f5 100644 --- a/spec/active_relation/relations/rename_spec.rb +++ b/spec/active_relation/relations/rename_spec.rb @@ -37,11 +37,18 @@ module ActiveRelation @renamed_relation.should have(@relation.attributes.size).attributes end end - + describe '#qualify' do - it "distributes over the relation and renames" do + it "descends" do Rename.new(@relation, @relation[:id] => :schmid).qualify. \ - should == Rename.new(@relation.qualify, @relation[:id].qualify => :schmid) + should == Rename.new(@relation, @relation[:id] => :schmid).descend(&:qualify) + end + end + + describe '#descend' do + it "distributes over the relation and renames" do + Rename.new(@relation, @relation[:id] => :schmid).descend(&:qualify). \ + should == Rename.new(@relation.descend(&:qualify), @relation[:id].qualify => :schmid) end end diff --git a/spec/active_relation/relations/selection_spec.rb b/spec/active_relation/relations/selection_spec.rb index 66ad54de19..b6db6bfd4a 100644 --- a/spec/active_relation/relations/selection_spec.rb +++ b/spec/active_relation/relations/selection_spec.rb @@ -16,9 +16,16 @@ module ActiveRelation end describe '#qualify' do - it "distributes over the relation and predicates" do + it "descends" do Selection.new(@relation, @predicate).qualify. \ - should == Selection.new(@relation.qualify, @predicate.qualify) + should == Selection.new(@relation, @predicate).descend(&:qualify) + end + end + + describe '#descend' do + it "distributes over the relation and predicates" do + Selection.new(@relation, @predicate).descend(&:qualify). \ + should == Selection.new(@relation.descend(&:qualify), @predicate.descend(&:qualify)) end end |