aboutsummaryrefslogtreecommitdiffstats
path: root/spec/active_relation/predicates/equality_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/active_relation/predicates/equality_spec.rb')
-rw-r--r--spec/active_relation/predicates/equality_spec.rb40
1 files changed, 21 insertions, 19 deletions
diff --git a/spec/active_relation/predicates/equality_spec.rb b/spec/active_relation/predicates/equality_spec.rb
index 9394e63835..d23893e438 100644
--- a/spec/active_relation/predicates/equality_spec.rb
+++ b/spec/active_relation/predicates/equality_spec.rb
@@ -1,28 +1,30 @@
require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
-describe ActiveRelation::Predicates::Equality do
- before do
- @relation1 = ActiveRelation::Relations::Table.new(:foo)
- @relation2 = ActiveRelation::Relations::Table.new(:bar)
- @attribute1 = ActiveRelation::Primitives::Attribute.new(@relation1, :name)
- @attribute2 = ActiveRelation::Primitives::Attribute.new(@relation2, :name)
- end
-
- describe '==' do
- it "obtains if attribute1 and attribute2 are identical" do
- ActiveRelation::Predicates::Equality.new(@attribute1, @attribute2).should == ActiveRelation::Predicates::Equality.new(@attribute1, @attribute2)
- ActiveRelation::Predicates::Equality.new(@attribute1, @attribute2).should_not == ActiveRelation::Predicates::Equality.new(@attribute1, @attribute1)
+module ActiveRelation
+ describe Equality do
+ before do
+ @relation1 = Table.new(:foo)
+ @relation2 = Table.new(:bar)
+ @attribute1 = Attribute.new(@relation1, :name)
+ @attribute2 = Attribute.new(@relation2, :name)
end
+
+ describe '==' do
+ it "obtains if attribute1 and attribute2 are identical" do
+ Equality.new(@attribute1, @attribute2).should == Equality.new(@attribute1, @attribute2)
+ Equality.new(@attribute1, @attribute2).should_not == Equality.new(@attribute1, @attribute1)
+ end
- it "obtains if the concrete type of the predicates are identical" do
- ActiveRelation::Predicates::Equality.new(@attribute1, @attribute2).should_not == ActiveRelation::Predicates::Binary.new(@attribute1, @attribute2)
- end
+ it "obtains if the concrete type of the predicates are identical" do
+ Equality.new(@attribute1, @attribute2).should_not == Binary.new(@attribute1, @attribute2)
+ end
- it "is commutative on the attributes" do
- ActiveRelation::Predicates::Equality.new(@attribute1, @attribute2).should == ActiveRelation::Predicates::Equality.new(@attribute2, @attribute1)
+ it "is commutative on the attributes" do
+ Equality.new(@attribute1, @attribute2).should == Equality.new(@attribute2, @attribute1)
+ end
end
- end
- describe '#to_sql' do
+ describe '#to_sql' do
+ end
end
end \ No newline at end of file