forked from rails/arel
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request rails#204 from trptcolin/visitor_dispatch_caching
Cache visitor dispatch on a per-visitor basis
- Loading branch information
Showing
2 changed files
with
28 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 | ||
|