aboutsummaryrefslogtreecommitdiffstats
path: root/spec/active_relation
diff options
context:
space:
mode:
Diffstat (limited to 'spec/active_relation')
-rw-r--r--spec/active_relation/unit/primitives/attribute_spec.rb7
-rw-r--r--spec/active_relation/unit/relations/table_spec.rb5
2 files changed, 9 insertions, 3 deletions
diff --git a/spec/active_relation/unit/primitives/attribute_spec.rb b/spec/active_relation/unit/primitives/attribute_spec.rb
index 95c972d814..d424bf4dff 100644
--- a/spec/active_relation/unit/primitives/attribute_spec.rb
+++ b/spec/active_relation/unit/primitives/attribute_spec.rb
@@ -68,6 +68,13 @@ module ActiveRelation
Attribute.new(@relation, :name).should =~ Attribute.new(@relation, :name, :ancestor => Attribute.new(@relation, :name))
end
end
+
+ describe 'hashing' do
+ it "implements hash equality" do
+ Attribute.new(@relation, 'name').should hash_the_same_as(Attribute.new(@relation, 'name'))
+ Attribute.new(@relation, 'name').should_not hash_the_same_as(Attribute.new(@relation, 'id'))
+ end
+ end
end
describe '#to_sql' do
diff --git a/spec/active_relation/unit/relations/table_spec.rb b/spec/active_relation/unit/relations/table_spec.rb
index 95ad7133db..41ed2dc404 100644
--- a/spec/active_relation/unit/relations/table_spec.rb
+++ b/spec/active_relation/unit/relations/table_spec.rb
@@ -75,9 +75,8 @@ module ActiveRelation
describe 'hashing' do
it "implements hash equality" do
- hash = {}
- hash[Table.new(:users)] = 1
- hash[Table.new(:users)].should == 1
+ Table.new(:users).should hash_the_same_as(Table.new(:users))
+ Table.new(:users).should_not hash_the_same_as(Table.new(:photos))
end
end