diff options
author | Matthew Draper <matthew@trebex.net> | 2014-04-08 15:00:38 +0930 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2014-04-08 15:15:07 +0930 |
commit | 23692184bbcc2e411ed6bc6d1eaea09aa0f0474f (patch) | |
tree | 97399058a87978e8c87871abbff5763f7885c890 /activerecord/test/cases | |
parent | de9f2f63b8548e2a8950c1727f0a1a6893713505 (diff) | |
download | rails-23692184bbcc2e411ed6bc6d1eaea09aa0f0474f.tar.gz rails-23692184bbcc2e411ed6bc6d1eaea09aa0f0474f.tar.bz2 rails-23692184bbcc2e411ed6bc6d1eaea09aa0f0474f.zip |
Give a deprecation message even when the lookup fails
If the supplied string doesn't contain a colon, it clearly cannot be a
database URL. They must have intended to do a key lookup, so even though
it failed, give the explanatory deprecation warning, and raise the
exception that lists the known configs.
Conveniently, this also simplifies our logical behaviour: if the string
matches a known configuration, or doesn't contain a colon (and is
therefore clearly not a URL), then we output a deprecation warning, and
behave exactly as we would if it were a symbol.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/connection_adapters/connection_handler_test.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/activerecord/test/cases/connection_adapters/connection_handler_test.rb b/activerecord/test/cases/connection_adapters/connection_handler_test.rb index ae4172f15c..dd03f57f19 100644 --- a/activerecord/test/cases/connection_adapters/connection_handler_test.rb +++ b/activerecord/test/cases/connection_adapters/connection_handler_test.rb @@ -89,8 +89,10 @@ module ActiveRecord def test_resolver_with_database_uri_and_unknown_string_key ENV['DATABASE_URL'] = "postgres://localhost/foo" config = { "not_production" => { "adapter" => "not_postgres", "database" => "not_foo" } } - assert_raises AdapterNotSpecified do - spec("production", config) + assert_deprecated do + assert_raises AdapterNotSpecified do + spec("production", config) + end end end |