提交 7147e524 编写于 作者: M Matthew Draper 提交者: GitHub

Merge pull request #29705 from y-yagi/do_not_update_secrets_yml_enc

Do not update `secrets.yml.enc` when secretes do not change
......@@ -105,7 +105,9 @@ def writing(contents)
yield tmp_path
write(File.read(tmp_path))
updated_contents = File.read(tmp_path)
write(updated_contents) if updated_contents != contents
ensure
FileUtils.rm(tmp_path) if File.exist?(tmp_path)
end
......
......@@ -111,6 +111,24 @@ def teardown
end
end
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
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")
end
end
end
private
def run_secrets_generator
Dir.chdir(app_path) do
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册