diff options
author | Yasuo Honda <yasuo.honda@gmail.com> | 2013-05-08 06:35:54 +0900 |
---|---|---|
committer | Yasuo Honda <yasuo.honda@gmail.com> | 2013-05-08 06:40:15 +0900 |
commit | 798cf2b9ef67faace7fb9f8d5ecfcf892a77eb62 (patch) | |
tree | cf567ba5972f2ea96be17a418a05622fd7309370 | |
parent | ca0275d36b395631725c4583db5a45c06443fdb9 (diff) | |
download | rails-798cf2b9ef67faace7fb9f8d5ecfcf892a77eb62.tar.gz rails-798cf2b9ef67faace7fb9f8d5ecfcf892a77eb62.tar.bz2 rails-798cf2b9ef67faace7fb9f8d5ecfcf892a77eb62.zip |
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.
-rw-r--r-- | activerecord/test/cases/sanitize_test.rb | 9 |
1 files changed, 4 insertions, 5 deletions
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 |