diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-06-27 09:11:47 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-06-27 09:11:47 -0700 |
commit | 0c8723af70b8518c1a9ae43e650afb433e078470 (patch) | |
tree | 00e7d03fd91ecf0b1ea3a4754582f136a9c2beb4 /test/visitors | |
parent | ec86deadf0483d52686c4b2a89c5bb79959e7e28 (diff) | |
download | rails-0c8723af70b8518c1a9ae43e650afb433e078470.tar.gz rails-0c8723af70b8518c1a9ae43e650afb433e078470.tar.bz2 rails-0c8723af70b8518c1a9ae43e650afb433e078470.zip |
visitors can define their own cache strategy for dispatch. fixes #57
Diffstat (limited to 'test/visitors')
-rw-r--r-- | test/visitors/test_to_sql.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/visitors/test_to_sql.rb b/test/visitors/test_to_sql.rb index d046e543e1..b52722ddd6 100644 --- a/test/visitors/test_to_sql.rb +++ b/test/visitors/test_to_sql.rb @@ -13,6 +13,22 @@ module Arel @attr = @table[:id] end + it 'can define a dispatch method' do + visited = false + viz = Class.new(Arel::Visitors::Visitor) { + define_method(:hello) do |node| + visited = true + end + + def dispatch + { Arel::Table => 'hello' } + end + }.new + + viz.accept(@table) + assert visited, 'hello method was called' + end + it "should be thread safe around usage of last_column" do visit_integer_column = Thread.new do Thread.stop |