aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/connection_specification/resolver_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/cases/connection_specification/resolver_test.rb')
-rw-r--r--activerecord/test/cases/connection_specification/resolver_test.rb51
1 files changed, 19 insertions, 32 deletions
diff --git a/activerecord/test/cases/connection_specification/resolver_test.rb b/activerecord/test/cases/connection_specification/resolver_test.rb
index f0a2cdca1a..c8dfc3244b 100644
--- a/activerecord/test/cases/connection_specification/resolver_test.rb
+++ b/activerecord/test/cases/connection_specification/resolver_test.rb
@@ -20,48 +20,27 @@ module ActiveRecord
def test_url_host_no_db
spec = resolve 'abstract://foo?encoding=utf8'
assert_equal({
- :adapter => "abstract",
- :host => "foo",
- :encoding => "utf8" }, spec)
+ adapter: "abstract",
+ host: "foo",
+ encoding: "utf8" }, spec)
end
def test_url_host_db
spec = resolve 'abstract://foo/bar?encoding=utf8'
assert_equal({
- :adapter => "abstract",
- :database => "bar",
- :host => "foo",
- :encoding => "utf8" }, spec)
+ adapter: "abstract",
+ database: "bar",
+ host: "foo",
+ encoding: "utf8" }, spec)
end
def test_url_port
spec = resolve 'abstract://foo:123?encoding=utf8'
assert_equal({
- :adapter => "abstract",
- :port => 123,
- :host => "foo",
- :encoding => "utf8" }, spec)
- end
-
- def test_url_query_numeric
- spec = resolve 'abstract://foo:123?encoding=utf8&int=500&float=10.9'
- assert_equal({
- :adapter => "abstract",
- :port => 123,
- :int => 500,
- :float => 10.9,
- :host => "foo",
- :encoding => "utf8" }, spec)
- end
-
- def test_url_query_boolean
- spec = resolve 'abstract://foo:123?true=true&false=false'
- assert_equal({
- :adapter => "abstract",
- :port => 123,
- :true => true,
- :false => false,
- :host => "foo" }, spec)
+ adapter: "abstract",
+ port: 123,
+ host: "foo",
+ encoding: "utf8" }, spec)
end
def test_encoded_password
@@ -70,6 +49,14 @@ module ActiveRecord
spec = resolve "abstract://foo:#{encoded_password}@localhost/bar"
assert_equal password, spec[:password]
end
+
+ def test_descriptive_error_message_when_adapter_is_missing
+ error = assert_raise(LoadError) do
+ resolve(adapter: 'non-existing')
+ end
+
+ assert_match "Could not load 'active_record/connection_adapters/non-existing_adapter'", error.message
+ end
end
end
end