From 424e39d6883e5ab53a0f2c5d27508b36b1fb5879 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 5 Nov 2010 14:05:10 -0700 Subject: adding proper columns to our fake table --- test/visitors/test_to_sql.rb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'test/visitors/test_to_sql.rb') 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 -- cgit v1.2.3