aboutsummaryrefslogtreecommitdiffstats
path: root/test/nodes/test_grouping.rb
blob: febf0bee40623cebaa8202d5deaa9a39798c0dff (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
require 'helper'

module Arel
  module Nodes
    describe 'Grouping' do
      it 'should create Equality nodes' do
        grouping = Grouping.new(Nodes.build_quoted('foo'))
        grouping.eq('foo').to_sql.must_be_like %q{('foo') = 'foo'}
      end

      describe 'equality' do
        it 'is equal with equal ivars' do
          array = [Grouping.new('foo'), Grouping.new('foo')]
          assert_equal 1, array.uniq.size
        end

        it 'is not equal with different ivars' do
          array = [Grouping.new('foo'), Grouping.new('bar')]
          assert_equal 2, array.uniq.size
        end
      end
    end
  end
end