From 44298c39e49d48546f3546a885c9da362bd48f28 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 21 Feb 2013 00:44:06 +1100 Subject: test DATABASE_URL without database.yml around --- railties/test/application/rake/dbs_test.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'railties/test/application') diff --git a/railties/test/application/rake/dbs_test.rb b/railties/test/application/rake/dbs_test.rb index ccb47663d4..813680738a 100644 --- a/railties/test/application/rake/dbs_test.rb +++ b/railties/test/application/rake/dbs_test.rb @@ -21,6 +21,8 @@ module ApplicationTests def set_database_url ENV['DATABASE_URL'] = "sqlite3://:@localhost/#{database_url_db_name}" + # ensure it's using the DATABASE_URL + FileUtils.rm_rf("#{app_path}/config/database.yml") end def expected -- cgit v1.2.3 From e3f5d023fffa59ae593810c702f5d6be0ef45651 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Thu, 21 Feb 2013 00:44:26 +1100 Subject: run the load_structure test in the test environment --- railties/test/application/rake/dbs_test.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'railties/test/application') diff --git a/railties/test/application/rake/dbs_test.rb b/railties/test/application/rake/dbs_test.rb index 813680738a..820b838702 100644 --- a/railties/test/application/rake/dbs_test.rb +++ b/railties/test/application/rake/dbs_test.rb @@ -168,9 +168,16 @@ module ApplicationTests end test 'db:test:load_structure with database_url' do - require "#{app_path}/config/environment" - set_database_url - db_test_load_structure + old_rails_env = ENV["RAILS_ENV"] + ENV["RAILS_ENV"] = 'test' + + begin + require "#{app_path}/config/environment" + set_database_url + db_test_load_structure + ensure + ENV["RAILS_ENV"] = old_rails_env + end end end end -- cgit v1.2.3