aboutsummaryrefslogtreecommitdiffstats
path: root/test/visitors/test_dispatch_contamination.rb
blob: d3c9e8af2edb3c5e1a64c6258cd3dff64f5f7349 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require 'helper'

module Arel
  module Visitors
    describe 'avoiding contamination between visitor dispatch tables' do
      before do
        @connection = Table.engine.connection
        @table = Table.new(:users)
      end

      it 'dispatches properly after failing upwards' do
        node = Nodes::Union.new(Nodes::True.new, Nodes::False.new)
        assert_equal "( TRUE UNION FALSE )", node.to_sql

        node.first # from Nodes::Node's Enumerable mixin

        assert_equal "( TRUE UNION FALSE )", node.to_sql
      end
    end
  end
end