diff options
Diffstat (limited to 'activerecord/test/cases/arel')
-rw-r--r-- | activerecord/test/cases/arel/collectors/sql_string_test.rb | 16 | ||||
-rw-r--r-- | activerecord/test/cases/arel/delete_manager_test.rb | 1 | ||||
-rw-r--r-- | activerecord/test/cases/arel/visitors/to_sql_test.rb | 2 |
3 files changed, 7 insertions, 12 deletions
diff --git a/activerecord/test/cases/arel/collectors/sql_string_test.rb b/activerecord/test/cases/arel/collectors/sql_string_test.rb index 380573494d..443c7eb54b 100644 --- a/activerecord/test/cases/arel/collectors/sql_string_test.rb +++ b/activerecord/test/cases/arel/collectors/sql_string_test.rb @@ -19,27 +19,21 @@ module Arel collect(node).value end - def ast_with_binds(bv) + def ast_with_binds table = Table.new(:users) manager = Arel::SelectManager.new table - manager.where(table[:age].eq(bv)) - manager.where(table[:name].eq(bv)) + manager.where(table[:age].eq(Nodes::BindParam.new("hello"))) + manager.where(table[:name].eq(Nodes::BindParam.new("world"))) manager.ast end def test_compile - bv = Nodes::BindParam.new(1) - collector = collect ast_with_binds bv - - sql = collector.compile ["hello", "world"] + sql = compile(ast_with_binds) assert_equal 'SELECT FROM "users" WHERE "users"."age" = ? AND "users"."name" = ?', sql end def test_returned_sql_uses_utf8_encoding - bv = Nodes::BindParam.new(1) - collector = collect ast_with_binds bv - - sql = collector.compile ["hello", "world"] + sql = compile(ast_with_binds) assert_equal sql.encoding, Encoding::UTF_8 end end diff --git a/activerecord/test/cases/arel/delete_manager_test.rb b/activerecord/test/cases/arel/delete_manager_test.rb index 17a5271039..0bad02f4d2 100644 --- a/activerecord/test/cases/arel/delete_manager_test.rb +++ b/activerecord/test/cases/arel/delete_manager_test.rb @@ -15,6 +15,7 @@ module Arel dm = Arel::DeleteManager.new dm.take 10 dm.from table + dm.key = table[:id] assert_match(/LIMIT 10/, dm.to_sql) end diff --git a/activerecord/test/cases/arel/visitors/to_sql_test.rb b/activerecord/test/cases/arel/visitors/to_sql_test.rb index e8ac50bfa3..b6426a211e 100644 --- a/activerecord/test/cases/arel/visitors/to_sql_test.rb +++ b/activerecord/test/cases/arel/visitors/to_sql_test.rb @@ -221,7 +221,7 @@ module Arel sql.must_be_like "foo AS bar" end - it "should visit_Bignum" do + it "should visit_Integer" do compile 8787878092 end |