Merge pull request #547 from nickhammond/envify/trim-lines

Enable trim mode with ERB
This commit is contained in:
Donal McBreen
2023-10-30 08:57:55 +00:00
committed by GitHub
2 changed files with 15 additions and 1 deletions

View File

@@ -354,6 +354,20 @@ class CliMainTest < CliTestCase
run_command("envify")
end
test "envify with blank line trimming" do
file = <<~EOF
HELLO=<%= 'world' %>
<% if true -%>
KEY=value
<% end -%>
EOF
File.expects(:read).with(".env.erb").returns(file.strip)
File.expects(:write).with(".env", "HELLO=world\nKEY=value\n", perm: 0600)
run_command("envify")
end
test "envify with destination" do
File.expects(:read).with(".env.world.erb").returns("HELLO=<%= 'world' %>")
File.expects(:write).with(".env.world", "HELLO=world", perm: 0600)