aboutsummaryrefslogtreecommitdiffstats
path: root/spec/relations
diff options
context:
space:
mode:
authorNick Kallen <nkallen@nick-kallens-computer-2.local>2008-01-05 15:32:22 -0800
committerNick Kallen <nkallen@nick-kallens-computer-2.local>2008-01-05 15:32:22 -0800
commitd1e5265a1db424e7361878772d32ae4ec39babe2 (patch)
tree89e3313c6207114dd706270d6b5b0c90f7fbf294 /spec/relations
parentd7b89d957dbceb4eeceb0b1d381474a4de70a14d (diff)
downloadrails-d1e5265a1db424e7361878772d32ae4ec39babe2.tar.gz
rails-d1e5265a1db424e7361878772d32ae4ec39babe2.tar.bz2
rails-d1e5265a1db424e7361878772d32ae4ec39babe2.zip
join relation qualification
Diffstat (limited to 'spec/relations')
-rw-r--r--spec/relations/join_relation_spec.rb9
-rw-r--r--spec/relations/order_relation_spec.rb2
-rw-r--r--spec/relations/projection_relation_spec.rb2
-rw-r--r--spec/relations/range_relation_spec.rb2
-rw-r--r--spec/relations/rename_relation_spec.rb6
-rw-r--r--spec/relations/selection_relation_spec.rb2
6 files changed, 13 insertions, 10 deletions
diff --git a/spec/relations/join_relation_spec.rb b/spec/relations/join_relation_spec.rb
index bae294440e..b7357b02e8 100644
--- a/spec/relations/join_relation_spec.rb
+++ b/spec/relations/join_relation_spec.rb
@@ -1,6 +1,6 @@
require File.join(File.dirname(__FILE__), '..', 'spec_helper')
-describe 'between two relations' do
+describe JoinRelation do
before do
@relation1 = TableRelation.new(:foo)
@relation2 = TableRelation.new(:bar)
@@ -18,6 +18,13 @@ describe 'between two relations' do
end
end
+ describe '#qualify' do
+ it 'distributes over the relations and predicates' do
+ JoinRelation.new(@relation1, @relation2, @predicate).qualify. \
+ should == JoinRelation.new(@relation1.qualify, @relation2.qualify, @predicate.qualify)
+ end
+ end
+
describe '#to_sql' do
before do
@relation1 = @relation1.select(@relation1[:id] == @relation2[:foo_id])
diff --git a/spec/relations/order_relation_spec.rb b/spec/relations/order_relation_spec.rb
index 62275ff0ac..8792683eec 100644
--- a/spec/relations/order_relation_spec.rb
+++ b/spec/relations/order_relation_spec.rb
@@ -17,7 +17,7 @@ describe OrderRelation do
end
describe '#qualify' do
- it "manufactures an order relation with qualified attributes and qualified relation" do
+ it "distributes over the relation and attributes" do
OrderRelation.new(@relation1, @attribute1).qualify. \
should == OrderRelation.new(@relation1.qualify, @attribute1.qualify)
end
diff --git a/spec/relations/projection_relation_spec.rb b/spec/relations/projection_relation_spec.rb
index eb74b5cedf..149669c5b2 100644
--- a/spec/relations/projection_relation_spec.rb
+++ b/spec/relations/projection_relation_spec.rb
@@ -17,7 +17,7 @@ describe ProjectionRelation do
end
describe '#qualify' do
- it "manufactures a projection relation with qualified attributes and qualified relation" do
+ it "distributes over teh relation and attributes" do
ProjectionRelation.new(@relation1, @attribute1).qualify. \
should == ProjectionRelation.new(@relation1.qualify, @attribute1.qualify)
end
diff --git a/spec/relations/range_relation_spec.rb b/spec/relations/range_relation_spec.rb
index 261afcaf8e..947bf35120 100644
--- a/spec/relations/range_relation_spec.rb
+++ b/spec/relations/range_relation_spec.rb
@@ -17,7 +17,7 @@ describe RangeRelation do
end
describe '#qualify' do
- it "manufactures a range relation with a qualified relation and a qualified range" do
+ it "distributes over the relation and attributes" do
pending
end
end
diff --git a/spec/relations/rename_relation_spec.rb b/spec/relations/rename_relation_spec.rb
index e7792d146a..7db329ad7a 100644
--- a/spec/relations/rename_relation_spec.rb
+++ b/spec/relations/rename_relation_spec.rb
@@ -12,10 +12,6 @@ describe RenameRelation do
should == RenameRelation.new(RenameRelation.new(@relation, @relation[:id] => :humpty), @relation[:name] => :dumpty)
end
- it "make this test less brittle wrt/ hash order" do
- pending
- end
-
it "raises an exception if the alias provided is already used" do
pending
end
@@ -48,7 +44,7 @@ describe RenameRelation do
end
describe '#qualify' do
- it "manufactures a rename relation with an identical attribute and alias, but with a qualified relation" do
+ it "distributes over the relation and renames" do
RenameRelation.new(@relation, @relation[:id] => :schmid).qualify. \
should == RenameRelation.new(@relation.qualify, @relation[:id].qualify => :schmid)
end
diff --git a/spec/relations/selection_relation_spec.rb b/spec/relations/selection_relation_spec.rb
index 395a3f7693..7ffb3b3676 100644
--- a/spec/relations/selection_relation_spec.rb
+++ b/spec/relations/selection_relation_spec.rb
@@ -27,7 +27,7 @@ describe SelectionRelation do
end
describe '#qualify' do
- it "manufactures a selection relation with qualified predicates and qualified relation" do
+ it "distributes over the relation and predicates" do
SelectionRelation.new(@relation1, @predicate1).qualify. \
should == SelectionRelation.new(@relation1.qualify, @predicate1.qualify)
end