diff options
Diffstat (limited to 'railties/test/secrets_test.rb')
-rw-r--r-- | railties/test/secrets_test.rb | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/railties/test/secrets_test.rb b/railties/test/secrets_test.rb index 06877bc76a..133d851819 100644 --- a/railties/test/secrets_test.rb +++ b/railties/test/secrets_test.rb @@ -35,15 +35,13 @@ class Rails::SecretsTest < ActiveSupport::TestCase test "reading with ENV variable" do run_secrets_generator do - begin - old_key = ENV["RAILS_MASTER_KEY"] - ENV["RAILS_MASTER_KEY"] = IO.binread("config/secrets.yml.key").strip - FileUtils.rm("config/secrets.yml.key") - - assert_match "# production:\n# external_api_key:", Rails::Secrets.read - ensure - ENV["RAILS_MASTER_KEY"] = old_key - end + old_key = ENV["RAILS_MASTER_KEY"] + ENV["RAILS_MASTER_KEY"] = IO.binread("config/secrets.yml.key").strip + FileUtils.rm("config/secrets.yml.key") + + assert_match "# production:\n# external_api_key:", Rails::Secrets.read + ensure + ENV["RAILS_MASTER_KEY"] = old_key end end |