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

describe Select, '==' do
  it "obtains for queries with identical attributes" do
    Select.new(:foo).should == Select.new(:foo)
    Select.new(:bar).should_not == Select.new(:foo)
  end
  
  it "obtains for queries with identical tables" do
    Select.new(:foo).from(:bar).should == Select.new(:foo).from(:bar)
    Select.new(:foo).from(:bar).should_not == Select.new(:foo).from(:foo)
  end
  
  it "obtains for queries with identical predicates" do
    Select.new(:foo).from(:bar).where(:baz).should == Select.new(:foo).from(:bar).where(:baz)
    Select.new(:foo).from(:bar).where(:baz).should_not == Select.new(:foo).from(:bar).where(:foo)
  end
  
end