From 798cf2b9ef67faace7fb9f8d5ecfcf892a77eb62 Mon Sep 17 00:00:00 2001 From: Yasuo Honda Date: Wed, 8 May 2013 06:35:54 +0900 Subject: Remove current_adapter? from test_sanitize_sql_hash_handles_associations Because of each adapter implementation differences, `expected_value` string needed to be handled by each adapter. This commit removes current_adapter by using ActiveRecord::ConnectionAdapters::Quoting methods. --- activerecord/test/cases/sanitize_test.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'activerecord/test') diff --git a/activerecord/test/cases/sanitize_test.rb b/activerecord/test/cases/sanitize_test.rb index f061c28e88..082570c55b 100644 --- a/activerecord/test/cases/sanitize_test.rb +++ b/activerecord/test/cases/sanitize_test.rb @@ -6,11 +6,10 @@ class SanitizeTest < ActiveRecord::TestCase end def test_sanitize_sql_hash_handles_associations - if current_adapter?(:MysqlAdapter, :Mysql2Adapter) - expected_value = "`adorable_animals`.`name` = 'Bambi'" - else - expected_value = "\"adorable_animals\".\"name\" = 'Bambi'" - end + quoted_bambi = ActiveRecord::Base.connection.quote("Bambi") + quoted_column_name = ActiveRecord::Base.connection.quote_column_name("name") + quoted_table_name = ActiveRecord::Base.connection.quote_table_name("adorable_animals") + expected_value = "#{quoted_table_name}.#{quoted_column_name} = #{quoted_bambi}" assert_equal expected_value, Binary.send(:sanitize_sql_hash, {adorable_animals: {name: 'Bambi'}}) end -- cgit v1.2.3