diff options
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/application/dummy_erb_compiler.rb | 7 | ||||
-rw-r--r-- | railties/test/application/rake/dbs_test.rb | 16 |
2 files changed, 22 insertions, 1 deletions
diff --git a/railties/lib/rails/application/dummy_erb_compiler.rb b/railties/lib/rails/application/dummy_erb_compiler.rb index c4659123bb..086b9e76f4 100644 --- a/railties/lib/rails/application/dummy_erb_compiler.rb +++ b/railties/lib/rails/application/dummy_erb_compiler.rb @@ -13,7 +13,12 @@ class DummyCompiler < ERB::Compiler # :nodoc: def compile_content(stag, out) case stag when "<%=" - out.push "_erbout << 'dummy_compiler'" + content = out.instance_variable_get(:@compiler).instance_variable_get(:@content) + if content.include?("?") && content.include?(":") + out.push "_erbout << 'dummy_key: dummy_value'" + else + out.push "_erbout << 'dummy_value'" + end end end end diff --git a/railties/test/application/rake/dbs_test.rb b/railties/test/application/rake/dbs_test.rb index 258066a7e6..ca2d45b1c9 100644 --- a/railties/test/application/rake/dbs_test.rb +++ b/railties/test/application/rake/dbs_test.rb @@ -122,6 +122,22 @@ module ApplicationTests db_create_and_drop("db/development.sqlite3", environment_loaded: false) end + test "db:create and db:drop dont raise errors when loading YAML with FIXME ERB" do + app_file "config/database.yml", <<-YAML + development: + <%= Rails.application.config.database ? 'database: db/development.sqlite3' : 'database: db/development.sqlite3' %> + 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 |