aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@plataformatec.com.br>2013-12-23 20:15:52 +0100
committerJosé Valim <jose.valim@plataformatec.com.br>2013-12-23 20:15:52 +0100
commitc390e60811b2e11bfd5d79b15bfb43690c1a1339 (patch)
treeacac77d1a71e5e2091b6abdd3a1c7146a6832960 /activerecord/test/cases
parentd22a359a18d4ff0e31cb96293f03687e5db719ba (diff)
downloadrails-c390e60811b2e11bfd5d79b15bfb43690c1a1339.tar.gz
rails-c390e60811b2e11bfd5d79b15bfb43690c1a1339.tar.bz2
rails-c390e60811b2e11bfd5d79b15bfb43690c1a1339.zip
Guarantee the connection resolver handles string values
This commit also cleans up the rake tasks that were checking for DATABASE_URL in different places. In fact, it would be nice to deprecate DATABASE_URL usage in the long term, considering the direction we are moving of allowing those in .yml files.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/connection_specification/resolver_test.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/activerecord/test/cases/connection_specification/resolver_test.rb b/activerecord/test/cases/connection_specification/resolver_test.rb
index 528de07eab..8d3813b47f 100644
--- a/activerecord/test/cases/connection_specification/resolver_test.rb
+++ b/activerecord/test/cases/connection_specification/resolver_test.rb
@@ -4,8 +4,8 @@ module ActiveRecord
module ConnectionAdapters
class ConnectionSpecification
class ResolverTest < ActiveRecord::TestCase
- def resolve(spec)
- Resolver.new(spec, {}).spec.config
+ def resolve(spec, config={})
+ Resolver.new(config).resolve(spec).config
end
def test_url_invalid_adapter
@@ -17,6 +17,14 @@ module ActiveRecord
# The abstract adapter is used simply to bypass the bit of code that
# checks that the adapter file can be required in.
+ def test_url_from_environment
+ spec = resolve :production, 'production' => 'abstract://foo?encoding=utf8'
+ assert_equal({
+ adapter: "abstract",
+ host: "foo",
+ encoding: "utf8" }, spec)
+ end
+
def test_url_host_no_db
spec = resolve 'abstract://foo?encoding=utf8'
assert_equal({