aboutsummaryrefslogtreecommitdiffstats
path: root/spec/algebra
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-07-28 09:33:51 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-07-28 09:33:51 -0700
commit03a0002d9f8fde60bd4ce87e7f5979eddc0ad3a4 (patch)
tree4c1917121bd4c356734677704b3cf6741a43566d /spec/algebra
parentf962fb70a07722483d4443d40805e6e2dd791fa1 (diff)
downloadrails-03a0002d9f8fde60bd4ce87e7f5979eddc0ad3a4.tar.gz
rails-03a0002d9f8fde60bd4ce87e7f5979eddc0ad3a4.tar.bz2
rails-03a0002d9f8fde60bd4ce87e7f5979eddc0ad3a4.zip
#hash #eql? and #== were only used in tests. removed them and wrote better tests
Diffstat (limited to 'spec/algebra')
-rw-r--r--spec/algebra/unit/relations/join_spec.rb7
-rw-r--r--spec/algebra/unit/relations/relation_spec.rb22
2 files changed, 17 insertions, 12 deletions
diff --git a/spec/algebra/unit/relations/join_spec.rb b/spec/algebra/unit/relations/join_spec.rb
index 5fa3269052..54034a2e32 100644
--- a/spec/algebra/unit/relations/join_spec.rb
+++ b/spec/algebra/unit/relations/join_spec.rb
@@ -8,13 +8,6 @@ module Arel
@predicate = @relation1[:id].eq(@relation2[:user_id])
end
- describe 'hashing' do
- it 'implements hash equality' do
- InnerJoin.new(@relation1, @relation2, @predicate) \
- .should hash_the_same_as(InnerJoin.new(@relation1, @relation2, @predicate))
- end
- end
-
describe '#attributes' do
it 'combines the attributes of the two relations' do
join = InnerJoin.new(@relation1, @relation2, @predicate)
diff --git a/spec/algebra/unit/relations/relation_spec.rb b/spec/algebra/unit/relations/relation_spec.rb
index 4e25de73d1..40b8c6585a 100644
--- a/spec/algebra/unit/relations/relation_spec.rb
+++ b/spec/algebra/unit/relations/relation_spec.rb
@@ -32,14 +32,23 @@ module Arel
describe '#join' do
describe 'when given a relation' do
it "manufactures an inner join operation between those two relations" do
- @relation.join(@relation).on(@predicate). \
- should == InnerJoin.new(@relation, @relation, @predicate)
+ join = @relation.join(@relation).on(@predicate)
+ join.relation1.should == @relation
+ join.relation2.should == @relation
+ join.predicates.should == [@predicate]
+ join.should be_kind_of(InnerJoin)
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 == StringJoin.new(@relation, arbitrary_string)
+ arbitrary_string = "ASDF"
+
+ join = @relation.join(arbitrary_string)
+ join.relation1.should == @relation
+ join.relation2.should == arbitrary_string
+ join.predicates.should == []
+ join.should be_kind_of StringJoin
end
end
@@ -52,8 +61,11 @@ module Arel
describe '#outer_join' do
it "manufactures a left outer join operation between those two relations" do
- @relation.outer_join(@relation).on(@predicate). \
- should == OuterJoin.new(@relation, @relation, @predicate)
+ join = @relation.outer_join(@relation).on(@predicate)
+ join.relation1.should == @relation
+ join.relation2.should == @relation
+ join.predicates.should == [@predicate]
+ join.should be_kind_of OuterJoin
end
end
end