aboutsummaryrefslogtreecommitdiffstats
path: root/spec/active_relation/unit/relations/relation_spec.rb
diff options
context:
space:
mode:
authorNick Kallen <nkallen@nick-kallens-computer-2.local>2008-04-11 15:53:45 -0700
committerNick Kallen <nkallen@nick-kallens-computer-2.local>2008-04-11 15:53:45 -0700
commit3967bd524da7b3c0b985c57670ceb7f5d48a0f1b (patch)
tree8e342a0ad2f6b27948731ad1c1433bcfb8aa2f29 /spec/active_relation/unit/relations/relation_spec.rb
parenteee3a766160cd32a4d9b5e1352858597005c9cee (diff)
downloadrails-3967bd524da7b3c0b985c57670ceb7f5d48a0f1b.tar.gz
rails-3967bd524da7b3c0b985c57670ceb7f5d48a0f1b.tar.bz2
rails-3967bd524da7b3c0b985c57670ceb7f5d48a0f1b.zip
string passthrough for joins
Diffstat (limited to 'spec/active_relation/unit/relations/relation_spec.rb')
-rw-r--r--spec/active_relation/unit/relations/relation_spec.rb27
1 files changed, 19 insertions, 8 deletions
diff --git a/spec/active_relation/unit/relations/relation_spec.rb b/spec/active_relation/unit/relations/relation_spec.rb
index 682ec88f10..70bf87271a 100644
--- a/spec/active_relation/unit/relations/relation_spec.rb
+++ b/spec/active_relation/unit/relations/relation_spec.rb
@@ -51,24 +51,35 @@ module ActiveRelation
end
describe '#join' do
- it "manufactures an inner join operation between those two relations" do
- @relation.join(@relation).on(@predicate).should == Join.new("INNER JOIN", @relation, @relation, @predicate)
+ describe 'when given a relation' do
+ it "manufactures an inner join operation between those two relations" do
+ @relation.join(@relation).on(@predicate). \
+ should == Join.new("INNER JOIN", @relation, @relation, @predicate)
+ end
+ end
+
+ describe "when given a string" do
+ it "manufactures a join operation with the string passed through" do
+ @relation.join(arbitrary_string = "ASDF").should == Join.new(arbitrary_string, @relation)
+ end
end
end
-
+
describe '#outer_join' do
it "manufactures a left outer join operation between those two relations" do
- @relation.outer_join(@relation).on(@predicate).should == Join.new("LEFT OUTER JOIN", @relation, @relation, @predicate)
- end
+ @relation.outer_join(@relation).on(@predicate). \
+ should == Join.new("LEFT OUTER JOIN", @relation, @relation, @predicate)
+ end
end
end
-
+
describe '#project' do
it "manufactures a projection relation" do
- @relation.project(@attribute1, @attribute2).should == Projection.new(@relation, @attribute1, @attribute2)
+ @relation.project(@attribute1, @attribute2). \
+ should == Projection.new(@relation, @attribute1, @attribute2)
end
end
-
+
describe '#as' do
it "manufactures an alias relation" do
@relation.as(:paul).should == Alias.new(@relation, :paul)