Setting nil or blank environment variables now properly formats output
as ENVVAR="" instead of ENVVAR=.
This commit is contained in:
parent
ca10a69e83
commit
fe022bb1c6
@ -88,7 +88,7 @@ module Whenever
|
||||
|
||||
output = []
|
||||
@env.each do |key, val|
|
||||
output << "#{key}=#{val}\n"
|
||||
output << "#{key}=#{val.blank? ? '""' : val}\n"
|
||||
end
|
||||
output << "\n"
|
||||
|
||||
|
@ -8,6 +8,8 @@ class OutputEnvTest < Test::Unit::TestCase
|
||||
<<-file
|
||||
env :MYVAR, 'blah'
|
||||
env 'MAILTO', "someone@example.com"
|
||||
env :BLANKVAR, ''
|
||||
env :NILVAR, nil
|
||||
file
|
||||
end
|
||||
|
||||
@ -18,6 +20,14 @@ class OutputEnvTest < Test::Unit::TestCase
|
||||
should "output MAILTO environment variable" do
|
||||
assert_match "MAILTO=someone@example.com", @output
|
||||
end
|
||||
|
||||
should "output BLANKVAR environment variable" do
|
||||
assert_match "BLANKVAR=\"\"", @output
|
||||
end
|
||||
|
||||
should "output NILVAR environment variable" do
|
||||
assert_match "NILVAR=\"\"", @output
|
||||
end
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in New Issue
Block a user