aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2017-07-21 16:03:00 -0400
committerGitHub <noreply@github.com>2017-07-21 16:03:00 -0400
commitdb02760ab66f59f04aaa16e134dbbf81338fac1e (patch)
treea3ce322b79031d6f882881f54a1b03518fb7f190
parentc942d3d23486e3de86b3be004ce61cc598b4fd75 (diff)
parentaf3b6c367b46ae9df599d090015481bab21974bf (diff)
downloadrails-db02760ab66f59f04aaa16e134dbbf81338fac1e.tar.gz
rails-db02760ab66f59f04aaa16e134dbbf81338fac1e.tar.bz2
rails-db02760ab66f59f04aaa16e134dbbf81338fac1e.zip
Merge pull request #29885 from freeletics/fix-false-positive-test
Fix false positive test related to wrong app root path.
-rw-r--r--railties/test/secrets_test.rb22
1 files changed, 11 insertions, 11 deletions
diff --git a/railties/test/secrets_test.rb b/railties/test/secrets_test.rb
index 744d831406..d78c253765 100644
--- a/railties/test/secrets_test.rb
+++ b/railties/test/secrets_test.rb
@@ -89,7 +89,6 @@ class Rails::SecretsTest < ActiveSupport::TestCase
yeah_yeah: lets-walk-in-the-cool-evening-light
end_of_secrets
- Rails.application.config.root = app_path
Rails.application.config.read_encrypted_secrets = true
Rails.application.instance_variable_set(:@secrets, nil) # Dance around caching 💃🕺
assert_equal "lets-walk-in-the-cool-evening-light", Rails.application.secrets.yeah_yeah
@@ -113,19 +112,17 @@ class Rails::SecretsTest < ActiveSupport::TestCase
test "do not update secrets.yml.enc when secretes do not change" do
run_secrets_generator do
- Dir.chdir(app_path) do
- Rails::Secrets.read_for_editing do |tmp_path|
- File.write(tmp_path, "Empty streets, empty nights. The Downtown Lights.")
- end
+ Rails::Secrets.read_for_editing do |tmp_path|
+ File.write(tmp_path, "Empty streets, empty nights. The Downtown Lights.")
+ end
- FileUtils.cp("config/secrets.yml.enc", "config/secrets.yml.enc.bk")
+ FileUtils.cp("config/secrets.yml.enc", "config/secrets.yml.enc.bk")
- Rails::Secrets.read_for_editing do |tmp_path|
- File.write(tmp_path, "Empty streets, empty nights. The Downtown Lights.")
- end
-
- assert_equal File.read("config/secrets.yml.enc.bk"), File.read("config/secrets.yml.enc")
+ Rails::Secrets.read_for_editing do |tmp_path|
+ File.write(tmp_path, "Empty streets, empty nights. The Downtown Lights.")
end
+
+ assert_equal File.read("config/secrets.yml.enc.bk"), File.read("config/secrets.yml.enc")
end
end
@@ -170,6 +167,9 @@ class Rails::SecretsTest < ActiveSupport::TestCase
Rails::Generators::EncryptedSecretsGenerator.start
end
+ # Make config.paths["config/secrets"] to be relative to app_path
+ Rails.application.config.root = app_path
+
yield
end
end