diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-11-05 14:05:10 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-11-05 14:05:10 -0700 |
commit | 424e39d6883e5ab53a0f2c5d27508b36b1fb5879 (patch) | |
tree | 5ba0268df9f31e02e41436db87f79db0e9a5569b /test/visitors | |
parent | d9d9944b37b959c6b6f00d4f38048cc541a56ad8 (diff) | |
download | rails-424e39d6883e5ab53a0f2c5d27508b36b1fb5879.tar.gz rails-424e39d6883e5ab53a0f2c5d27508b36b1fb5879.tar.bz2 rails-424e39d6883e5ab53a0f2c5d27508b36b1fb5879.zip |
adding proper columns to our fake table
Diffstat (limited to 'test/visitors')
-rw-r--r-- | test/visitors/test_to_sql.rb | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/test/visitors/test_to_sql.rb b/test/visitors/test_to_sql.rb index a6042ef9c3..8723332005 100644 --- a/test/visitors/test_to_sql.rb +++ b/test/visitors/test_to_sql.rb @@ -69,9 +69,8 @@ module Arel end it "should visit_TrueClass" do - test = @attr.eq(true) - test.left.column.type = :boolean - @visitor.accept(test).must_be_like %{ "users"."id" = 't' } + test = Table.new(:users)[:bool].eq(true) + @visitor.accept(test).must_be_like %{ "users"."bool" = 't' } end describe "Nodes::Ordering" do @@ -113,6 +112,7 @@ module Arel end it 'uses the same column for escaping values' do + @attr = Table.new(:users)[:name] visitor = Class.new(ToSql) do attr_accessor :expected @@ -124,16 +124,15 @@ module Arel in_node = Nodes::In.new @attr, %w{ a b c } visitor = visitor.new(Table.engine) visitor.expected = @attr.column - visitor.accept(in_node).must_equal %("users"."id" IN ('a', 'b', 'c')) + visitor.accept(in_node).must_equal %("users"."name" IN ('a', 'b', 'c')) end end describe 'Equality' do it "should escape strings" do - test = @attr.eq 'Aaron Patterson' - test.left.column.type = :string + test = Table.new(:users)[:name].eq 'Aaron Patterson' @visitor.accept(test).must_be_like %{ - "users"."id" = 'Aaron Patterson' + "users"."name" = 'Aaron Patterson' } end end |