aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
Diffstat (limited to 'railties')
-rw-r--r--railties/test/application/rake/dbs_test.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/railties/test/application/rake/dbs_test.rb b/railties/test/application/rake/dbs_test.rb
index e08cd09abd..79c521dbf6 100644
--- a/railties/test/application/rake/dbs_test.rb
+++ b/railties/test/application/rake/dbs_test.rb
@@ -40,6 +40,15 @@ module ApplicationTests
end
end
+ def db_create_with_warning(expected_database)
+ Dir.chdir(app_path) do
+ output = rails("db:create")
+ assert_match(/Rails couldn't infer whether you are using multiple databases/, output)
+ assert_match(/Created database/, output)
+ assert File.exist?(expected_database)
+ end
+ end
+
test "db:create and db:drop without database URL" do
require "#{app_path}/config/environment"
db_create_and_drop ActiveRecord::Base.configurations[Rails.env]["database"]
@@ -86,6 +95,25 @@ module ApplicationTests
db_create_and_drop("db/development.sqlite3", environment_loaded: false)
end
+ test "db:create and db:drop show warning but doesn't raise errors when loading YAML with alias ERB" do
+ app_file "config/database.yml", <<-YAML
+ sqlite: &sqlite
+ adapter: sqlite3
+ database: db/development.sqlite3
+
+ development:
+ <<: *<%= ENV["DB"] || "sqlite" %>
+ YAML
+
+ app_file "config/environments/development.rb", <<-RUBY
+ Rails.application.configure do
+ config.database = "db/development.sqlite3"
+ end
+ RUBY
+
+ db_create_with_warning("db/development.sqlite3")
+ end
+
test "db:create and db:drop don't raise errors when loading YAML containing conditional statements in ERB" do
app_file "config/database.yml", <<-YAML
development: