aboutsummaryrefslogtreecommitdiffstats
path: root/spec/nodes
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-09-27 13:12:15 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-09-27 13:12:15 -0700
commit77fa5fa5f7cc21824edb5b1c1ebccd58f92e982b (patch)
tree80c71416e19948b7e0c4c3b9aacd36672ab62d1d /spec/nodes
parentec998ae9a6aeda09ad64bb94a50ac8b9fccd246d (diff)
downloadrails-77fa5fa5f7cc21824edb5b1c1ebccd58f92e982b.tar.gz
rails-77fa5fa5f7cc21824edb5b1c1ebccd58f92e982b.tar.bz2
rails-77fa5fa5f7cc21824edb5b1c1ebccd58f92e982b.zip
to_sql on nodes may be passed an engine
Diffstat (limited to 'spec/nodes')
-rw-r--r--spec/nodes/equality_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/nodes/equality_spec.rb b/spec/nodes/equality_spec.rb
index 81eea4d482..f1ed7a6904 100644
--- a/spec/nodes/equality_spec.rb
+++ b/spec/nodes/equality_spec.rb
@@ -26,6 +26,24 @@ module Arel
check left.right.should == left.operand2
end
end
+
+ describe 'to_sql' do
+ it 'takes an engine' do
+ engine = FakeRecord::Base.new
+ engine.connection.extend Module.new {
+ attr_accessor :quote_count
+ def quote(*args) @quote_count += 1; super; end
+ def quote_column_name(*args) @quote_count += 1; super; end
+ def quote_table_name(*args) @quote_count += 1; super; end
+ }
+ engine.connection.quote_count = 0
+
+ attr = Table.new(:users)[:id]
+ test = attr.eq(10)
+ test.to_sql engine
+ check engine.connection.quote_count.should == 2
+ end
+ end
end
describe 'or' do