From d871696b4a8b021b67a3ce6c3cb5d5dcbbb578fe Mon Sep 17 00:00:00 2001 From: Jeremy Baker Date: Thu, 4 Feb 2016 10:59:52 -0800 Subject: Add a resolver test for the missing scheme --- .../test/cases/connection_adapters/connection_specification_test.rb | 5 +++++ activerecord/test/cases/connection_specification/resolver_test.rb | 6 ++++++ 2 files changed, 11 insertions(+) (limited to 'activerecord') diff --git a/activerecord/test/cases/connection_adapters/connection_specification_test.rb b/activerecord/test/cases/connection_adapters/connection_specification_test.rb index ea2196cda2..99fe7020ea 100644 --- a/activerecord/test/cases/connection_adapters/connection_specification_test.rb +++ b/activerecord/test/cases/connection_adapters/connection_specification_test.rb @@ -7,6 +7,11 @@ module ActiveRecord spec = ConnectionSpecification.new({ :a => :b }, "bar") assert_not_equal(spec.config.object_id, spec.dup.config.object_id) end + + def test_handle_missing_scheme + spec = ConnectionSpecification.new({ :url => 'testing' }, "bar") + assert_not_equal(spec.config.object_id, spec.dup.config.object_id) + end end end end diff --git a/activerecord/test/cases/connection_specification/resolver_test.rb b/activerecord/test/cases/connection_specification/resolver_test.rb index 3c2f5d4219..358b6ad537 100644 --- a/activerecord/test/cases/connection_specification/resolver_test.rb +++ b/activerecord/test/cases/connection_specification/resolver_test.rb @@ -57,6 +57,12 @@ module ActiveRecord "encoding" => "utf8" }, spec) end + def test_url_missing_scheme + spec = resolve 'foo' + assert_equal({ + "database" => "foo" }, spec) + end + def test_url_host_db spec = resolve 'abstract://foo/bar?encoding=utf8' assert_equal({ -- cgit v1.2.3