diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-04-26 23:13:59 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-26 23:13:59 -0700 |
commit | 28cd12c3454338450c6a505ae9997380065367c8 (patch) | |
tree | c350dcd01f313585b1efaa277ab95222df2d0112 /railties/test/application | |
parent | 1583e260f9278986f3c4ea3702c081727838c290 (diff) | |
parent | dfc361df364c0c01a244355fe39f5871fb5b00f9 (diff) | |
download | rails-28cd12c3454338450c6a505ae9997380065367c8.tar.gz rails-28cd12c3454338450c6a505ae9997380065367c8.tar.bz2 rails-28cd12c3454338450c6a505ae9997380065367c8.zip |
Merge pull request #28896 from pschambacher/load_with_shared
Added a shared section to config/database.yml that will be loaded for all envs
Diffstat (limited to 'railties/test/application')
-rw-r--r-- | railties/test/application/configuration_test.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb index 07c6afed7f..06767167a9 100644 --- a/railties/test/application/configuration_test.rb +++ b/railties/test/application/configuration_test.rb @@ -1407,6 +1407,40 @@ module ApplicationTests assert_match "config/database", err.message end + test "loads database.yml using shared keys" do + app_file "config/database.yml", <<-YAML + shared: + username: bobby + adapter: sqlite3 + + development: + database: 'dev_db' + YAML + + app "development" + + ar_config = Rails.application.config.database_configuration + assert_equal "sqlite3", ar_config["development"]["adapter"] + assert_equal "bobby", ar_config["development"]["username"] + assert_equal "dev_db", ar_config["development"]["database"] + end + + test "loads database.yml using shared keys for undefined environments" do + app_file "config/database.yml", <<-YAML + shared: + username: bobby + adapter: sqlite3 + database: 'dev_db' + YAML + + app "development" + + ar_config = Rails.application.config.database_configuration + assert_equal "sqlite3", ar_config["development"]["adapter"] + assert_equal "bobby", ar_config["development"]["username"] + assert_equal "dev_db", ar_config["development"]["database"] + end + test "config.action_mailer.show_previews defaults to true in development" do app "development" |