Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Don't deprecate after all

  • Loading branch information...
commit 88cd65b174d9a75d9cb0e5e06a57615ccc80fff1 1 parent 615e0dc
@matthewd matthewd authored
View
18 activerecord/lib/active_record/connection_handling.rb
@@ -73,22 +73,8 @@ def resolve
def config
@raw_config.dup.tap do |cfg|
if url = ENV['DATABASE_URL']
- if cfg[@env]
- if cfg[@env]["url"]
- # Nothing to do
- else
- ActiveSupport::Deprecation.warn "Overriding database configuration with DATABASE_URL without using an ERB tag in database.yml is deprecated. Please update the entry for #{@env.inspect}:\n\n" \
- " #{@env}:\n url: <%= ENV['DATABASE_URL'] %>\n\n"\
- "This will be required in Rails 4.2"
- cfg[@env]["url"] = url
- end
- else
- cfg[@env] = {}
- ActiveSupport::Deprecation.warn "Supplying DATABASE_URL without a matching entry in database.yml is deprecated. Please add an entry for #{@env.inspect}:\n\n" \
- " #{@env}:\n url: <%= ENV['DATABASE_URL'] %>\n\n"\
- "This will be required in Rails 4.2"
- cfg[@env]["url"] ||= url
- end
+ cfg[@env] ||= {}
+ cfg[@env]["url"] ||= url
end
end
end
View
20 activerecord/test/cases/connection_adapters/connection_handler_test.rb
@@ -28,7 +28,7 @@ def spec(spec, config)
def test_resolver_with_database_uri_and_current_env_symbol_key
ENV['DATABASE_URL'] = "postgres://localhost/foo"
config = { "not_production" => { "adapter" => "not_postgres", "database" => "not_foo" } }
- actual = assert_deprecated { resolve(:default_env, config) }
+ actual = resolve(:default_env, config)
expected = { "adapter"=>"postgresql", "database"=>"foo", "host"=>"localhost" }
assert_equal expected, actual
end
@@ -44,7 +44,7 @@ def test_resolver_with_database_uri_and_and_current_env_string_key
def test_resolver_with_database_uri_and_known_key
ENV['DATABASE_URL'] = "postgres://localhost/foo"
config = { "production" => { "adapter" => "not_postgres", "database" => "not_foo", "host" => "localhost" } }
- actual = assert_deprecated { resolve(:production, config) }
+ actual = resolve(:production, config)
expected = { "adapter"=>"not_postgres", "database"=>"not_foo", "host"=>"localhost" }
assert_equal expected, actual
end
@@ -52,10 +52,8 @@ def test_resolver_with_database_uri_and_known_key
def test_resolver_with_database_uri_and_unknown_symbol_key
ENV['DATABASE_URL'] = "postgres://localhost/foo"
config = { "not_production" => { "adapter" => "not_postgres", "database" => "not_foo" } }
- assert_deprecated do
- assert_raises AdapterNotSpecified do
- resolve(:production, config)
- end
+ assert_raises AdapterNotSpecified do
+ resolve(:production, config)
end
end
@@ -72,7 +70,7 @@ def test_resolver_with_database_uri_and_unknown_string_key
def test_resolver_with_database_uri_and_supplied_url
ENV['DATABASE_URL'] = "not-postgres://not-localhost/not_foo"
config = { "production" => { "adapter" => "also_not_postgres", "database" => "also_not_foo" } }
- actual = assert_deprecated { resolve("postgres://localhost/foo", config) }
+ actual = resolve("postgres://localhost/foo", config)
expected = { "adapter"=>"postgresql", "database"=>"foo", "host"=>"localhost" }
assert_equal expected, actual
end
@@ -86,7 +84,7 @@ def test_jdbc_url
def test_environment_does_not_exist_in_config_url_does_exist
ENV['DATABASE_URL'] = "postgres://localhost/foo"
config = { "not_default_env" => { "adapter" => "not_postgres", "database" => "not_foo" } }
- actual = assert_deprecated { klass.new(config).resolve }
+ actual = klass.new(config).resolve
expect_prod = { "adapter"=>"postgresql", "database"=>"foo", "host"=>"localhost" }
assert_equal expect_prod, actual["default_env"]
end
@@ -131,7 +129,7 @@ def test_blank_with_database_url
ENV['DATABASE_URL'] = "postgres://localhost/foo"
config = {}
- actual = assert_deprecated { klass.new(config).resolve }
+ actual = klass.new(config).resolve
expected = { "adapter" => "postgresql",
"database" => "foo",
"host" => "localhost" }
@@ -162,7 +160,7 @@ def test_merge_no_conflicts_with_database_url
ENV['DATABASE_URL'] = "postgres://localhost/foo"
config = {"default_env" => { "pool" => "5" } }
- actual = assert_deprecated { klass.new(config).resolve }
+ actual = klass.new(config).resolve
expected = { "default_env" =>
{ "adapter" => "postgresql",
"database" => "foo",
@@ -177,7 +175,7 @@ def test_merge_conflicts_with_database_url
ENV['DATABASE_URL'] = "postgres://localhost/foo"
config = {"default_env" => { "adapter" => "NOT-POSTGRES", "database" => "NOT-FOO", "pool" => "5" } }
- actual = assert_deprecated { klass.new(config).resolve }
+ actual = klass.new(config).resolve
expected = { "default_env" =>
{ "adapter" => "postgresql",
"database" => "foo",
Please sign in to comment.
Something went wrong with that request. Please try again.