Enable trim mode with ERB

This commit is contained in:
Nick Hammond
2023-10-24 17:09:05 -07:00
parent 83a2d52ff4
commit 6c36c82153
2 changed files with 15 additions and 1 deletions

View File

@@ -346,6 +346,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)