diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-27 11:32:04 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-27 11:32:04 -0700 |
commit | ec998ae9a6aeda09ad64bb94a50ac8b9fccd246d (patch) | |
tree | d2a14792d04c89549473173000517093ce4d7ef0 /spec/visitors | |
parent | a25b9cbc391e7040fbbbccc932339cb57d11e531 (diff) | |
download | rails-ec998ae9a6aeda09ad64bb94a50ac8b9fccd246d.tar.gz rails-ec998ae9a6aeda09ad64bb94a50ac8b9fccd246d.tar.bz2 rails-ec998ae9a6aeda09ad64bb94a50ac8b9fccd246d.zip |
using the last seen column for quoting
Diffstat (limited to 'spec/visitors')
-rw-r--r-- | spec/visitors/to_sql_spec.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/spec/visitors/to_sql_spec.rb b/spec/visitors/to_sql_spec.rb index 25642ee947..c234a2d58e 100644 --- a/spec/visitors/to_sql_spec.rb +++ b/spec/visitors/to_sql_spec.rb @@ -13,6 +13,12 @@ module Arel sql = @visitor.accept Nodes::Equality.new(false, false) sql.should be_like %{ 'f' = 'f' } end + + it 'should use the column to quote' do + table = Table.new(:users) + sql = @visitor.accept Nodes::Equality.new(table[:id], '1-fooo') + sql.should be_like %{ "users"."id" = 1 } + end end it "should visit_DateTime" do @@ -55,7 +61,9 @@ module Arel end it "should visit_TrueClass" do - @visitor.accept(@attr.eq(true)).should be_like %{ "users"."id" = 't' } + test = @attr.eq(true) + test.left.column.type = :boolean + @visitor.accept(test).should be_like %{ "users"."id" = 't' } end describe "Nodes::In" do @@ -91,6 +99,7 @@ module Arel describe 'Equality' do it "should escape strings" do test = @attr.eq 'Aaron Patterson' + test.left.column.type = :string @visitor.accept(test).should be_like %{ "users"."id" = 'Aaron Patterson' } |