From 03a0002d9f8fde60bd4ce87e7f5979eddc0ad3a4 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 28 Jul 2010 09:33:51 -0700 Subject: #hash #eql? and #== were only used in tests. removed them and wrote better tests --- spec/algebra/unit/relations/join_spec.rb | 7 ------- spec/algebra/unit/relations/relation_spec.rb | 22 +++++++++++++++++----- 2 files changed, 17 insertions(+), 12 deletions(-) (limited to 'spec/algebra') 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 -- cgit v1.2.3