aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-07-30 10:08:47 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-07-30 10:08:47 -0700
commit0e957e05acc8bd53a42d53bf94d6cd4f2441737a (patch)
treea79f97d8b5c4da7cb319f140bedd1f56a2cbc718
parentd22b2169f7151d076b06bfa5da85dbe5497d8ea4 (diff)
downloadrails-0e957e05acc8bd53a42d53bf94d6cd4f2441737a.tar.gz
rails-0e957e05acc8bd53a42d53bf94d6cd4f2441737a.tar.bz2
rails-0e957e05acc8bd53a42d53bf94d6cd4f2441737a.zip
better tests for Where construction, removing Where#==
-rw-r--r--lib/arel/algebra/relations/operations/where.rb7
-rw-r--r--spec/algebra/unit/relations/relation_spec.rb13
2 files changed, 11 insertions, 9 deletions
diff --git a/lib/arel/algebra/relations/operations/where.rb b/lib/arel/algebra/relations/operations/where.rb
index 3b70b49f3a..d851aebc44 100644
--- a/lib/arel/algebra/relations/operations/where.rb
+++ b/lib/arel/algebra/relations/operations/where.rb
@@ -12,13 +12,6 @@ module Arel
@wheres ||= relation.wheres + predicates
end
- def == other
- super ||
- Where === other &&
- relation == other.relation &&
- predicates == other.predicates
- end
-
def engine
engine = relation.engine
diff --git a/spec/algebra/unit/relations/relation_spec.rb b/spec/algebra/unit/relations/relation_spec.rb
index f4769526da..ec311d0c43 100644
--- a/spec/algebra/unit/relations/relation_spec.rb
+++ b/spec/algebra/unit/relations/relation_spec.rb
@@ -97,11 +97,20 @@ module Arel
end
it "manufactures a where relation" do
- @relation.where(@predicate).should == Where.new(@relation, [@predicate])
+ where = @relation.where(@predicate)
+ where.relation.should == @relation
+ where.predicates.should == [@predicate]
+ where.should be_kind_of Where
end
it "accepts arbitrary strings" do
- @relation.where("arbitrary").should == Where.new(@relation, ["arbitrary"])
+ where = @relation.where("arbitrary")
+ where.relation.should == @relation
+
+ where.predicates.length.should == 1
+ where.predicates.first.value.should == "arbitrary"
+
+ where.should be_kind_of Where
end
describe 'when given a blank predicate' do