diff options
author | Vishal Telangre <the@vishaltelangre.com> | 2019-05-15 22:25:59 +0530 |
---|---|---|
committer | Vishal Telangre <the@vishaltelangre.com> | 2019-05-15 22:26:07 +0530 |
commit | ae9be137133530913d4ee13980eabc2577de317f (patch) | |
tree | cec3393d7e90ccfc7b20b6d5e0b211f3d4475ee5 /railties/test/application/rake | |
parent | 13d6aa3a7b70bca66c4abda7721329ad1863c24c (diff) | |
download | rails-ae9be137133530913d4ee13980eabc2577de317f.tar.gz rails-ae9be137133530913d4ee13980eabc2577de317f.tar.bz2 rails-ae9be137133530913d4ee13980eabc2577de317f.zip |
Fix: DummyCompiler embeds invalid YAML content
Fixes https://github.com/rails/rails/issues/36285.
Follow up of https://github.com/rails/rails/pull/36237.
Diffstat (limited to 'railties/test/application/rake')
-rw-r--r-- | railties/test/application/rake/dbs_test.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/railties/test/application/rake/dbs_test.rb b/railties/test/application/rake/dbs_test.rb index ca2d45b1c9..e08cd09abd 100644 --- a/railties/test/application/rake/dbs_test.rb +++ b/railties/test/application/rake/dbs_test.rb @@ -138,6 +138,23 @@ module ApplicationTests db_create_and_drop("db/development.sqlite3", environment_loaded: false) end + test "db:create and db:drop don't raise errors when loading YAML which contains a key's value as an ERB statement" do + app_file "config/database.yml", <<-YAML + development: + database: <%= Rails.application.config.database ? 'db/development.sqlite3' : 'db/development.sqlite3' %> + custom_option: <%= ENV['CUSTOM_OPTION'] %> + adapter: sqlite3 + YAML + + app_file "config/environments/development.rb", <<-RUBY + Rails.application.configure do + config.database = "db/development.sqlite3" + end + RUBY + + db_create_and_drop("db/development.sqlite3", environment_loaded: false) + end + def with_database_existing Dir.chdir(app_path) do set_database_url |