aboutsummaryrefslogtreecommitdiffstats
path: root/spec/relations/join_relation_spec.rb
blob: 7309563cd5a6350242177dec327c782c6d4cdcb0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require File.join(File.dirname(__FILE__), '..', 'spec_helper')

describe JoinRelation, 'between two relations' do
  before do
    @relation1 = TableRelation.new(:foo)
    @relation2 = TableRelation.new(:bar)
    @predicate = Predicate.new
  end
  
  describe JoinRelation, '==' do
    it "obtains if the two relations and the predicate are identical" do
      JoinRelation.new(@relation1, @relation2, @predicate).should == JoinRelation.new(@relation1, @relation2, @predicate)
      JoinRelation.new(@relation1, @relation2, @predicate).should_not == JoinRelation.new(@relation1, @relation1, @predicate)
    end
  
    it "is commutative on the relations" do
      JoinRelation.new(@relation1, @relation2, @predicate).should == JoinRelation.new(@relation2, @relation1, @predicate)
    end
  end
end