Permalink
Browse files

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.
  • Loading branch information...
1 parent ca0275d commit 798cf2b9ef67faace7fb9f8d5ecfcf892a77eb62 @yahonda yahonda committed May 7, 2013
Showing with 4 additions and 5 deletions.
  1. +4 −5 activerecord/test/cases/sanitize_test.rb
@@ -6,11 +6,10 @@ def setup
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

0 comments on commit 798cf2b

Please sign in to comment.