From 5d82c1fc56bedb3e0b736ec06b106b2989918978 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Mon, 29 Oct 2012 01:45:42 -0200 Subject: Make Active Record tests pass in isolation Also remove the feature detecting for Ruby 1.9 --- .../connection_adapters/abstract/connection_specification.rb | 3 +-- activerecord/test/cases/connection_specification/resolver_test.rb | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb index 63ab470fff..f366392c50 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb @@ -68,8 +68,7 @@ module ActiveRecord :database => config.path.sub(%r{^/},""), :host => config.host } spec.reject!{ |_,value| !value } - uri_parser = URI.const_defined?(:Parser) ? URI::Parser.new : URI - spec.map { |key,value| spec[key] = uri_parser.unescape(value) if value.is_a?(String) } + spec.map { |key,value| spec[key] = URI.unescape(value) if value.is_a?(String) } if config.query options = Hash[config.query.split("&").map{ |pair| pair.split("=") }].symbolize_keys spec.merge!(options) diff --git a/activerecord/test/cases/connection_specification/resolver_test.rb b/activerecord/test/cases/connection_specification/resolver_test.rb index 79f0c65859..46fc1a252f 100644 --- a/activerecord/test/cases/connection_specification/resolver_test.rb +++ b/activerecord/test/cases/connection_specification/resolver_test.rb @@ -42,7 +42,7 @@ module ActiveRecord def test_encoded_password skip "only if mysql is available" unless current_adapter?(:MysqlAdapter) or current_adapter?(:Mysql2Adapter) password = 'am@z1ng_p@ssw0rd#!' - encoded_password = URI.encode_www_form_component(password) + encoded_password = URI.respond_to?(:encode_www_form_component) ? URI.encode_www_form_component(password) : "am%40z1ng_p%40ssw0rd%23%21" spec = resolve "mysql://foo:#{encoded_password}@localhost/bar" assert_equal password, spec[:password] end -- cgit v1.2.3