@@ -89,7 +89,6 @@ def teardown
89
89
yeah_yeah: lets-walk-in-the-cool-evening-light
90
90
end_of_secrets
91
91
92
- Rails . application . config . root = app_path
93
92
Rails . application . config . read_encrypted_secrets = true
94
93
Rails . application . instance_variable_set ( :@secrets , nil ) # Dance around caching 💃🕺
95
94
assert_equal "lets-walk-in-the-cool-evening-light" , Rails . application . secrets . yeah_yeah
@@ -113,19 +112,17 @@ def teardown
113
112
114
113
test "do not update secrets.yml.enc when secretes do not change" do
115
114
run_secrets_generator do
116
- Dir . chdir ( app_path ) do
117
- Rails ::Secrets . read_for_editing do |tmp_path |
118
- File . write ( tmp_path , "Empty streets, empty nights. The Downtown Lights." )
119
- end
115
+ Rails ::Secrets . read_for_editing do |tmp_path |
116
+ File . write ( tmp_path , "Empty streets, empty nights. The Downtown Lights." )
117
+ end
120
118
121
- FileUtils . cp ( "config/secrets.yml.enc" , "config/secrets.yml.enc.bk" )
119
+ FileUtils . cp ( "config/secrets.yml.enc" , "config/secrets.yml.enc.bk" )
122
120
123
- Rails ::Secrets . read_for_editing do |tmp_path |
124
- File . write ( tmp_path , "Empty streets, empty nights. The Downtown Lights." )
125
- end
126
-
127
- assert_equal File . read ( "config/secrets.yml.enc.bk" ) , File . read ( "config/secrets.yml.enc" )
121
+ Rails ::Secrets . read_for_editing do |tmp_path |
122
+ File . write ( tmp_path , "Empty streets, empty nights. The Downtown Lights." )
128
123
end
124
+
125
+ assert_equal File . read ( "config/secrets.yml.enc.bk" ) , File . read ( "config/secrets.yml.enc" )
129
126
end
130
127
end
131
128
@@ -170,6 +167,9 @@ def run_secrets_generator
170
167
Rails ::Generators ::EncryptedSecretsGenerator . start
171
168
end
172
169
170
+ # Make config.paths["config/secrets"] to be relative to app_path
171
+ Rails . application . config . root = app_path
172
+
173
173
yield
174
174
end
175
175
end
0 commit comments