blob: 9394e63835356808595884b987475d7166b2f8a6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
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)
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 "is commutative on the attributes" do
ActiveRelation::Predicates::Equality.new(@attribute1, @attribute2).should == ActiveRelation::Predicates::Equality.new(@attribute2, @attribute1)
end
end
describe '#to_sql' do
end
end
|