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 = []
|
output = []
|
||||||
@env.each do |key, val|
|
@env.each do |key, val|
|
||||||
output << "#{key}=#{val}\n"
|
output << "#{key}=#{val.blank? ? '""' : val}\n"
|
||||||
end
|
end
|
||||||
output << "\n"
|
output << "\n"
|
||||||
|
|
||||||
|
@ -8,6 +8,8 @@ class OutputEnvTest < Test::Unit::TestCase
|
|||||||
<<-file
|
<<-file
|
||||||
env :MYVAR, 'blah'
|
env :MYVAR, 'blah'
|
||||||
env 'MAILTO', "someone@example.com"
|
env 'MAILTO', "someone@example.com"
|
||||||
|
env :BLANKVAR, ''
|
||||||
|
env :NILVAR, nil
|
||||||
file
|
file
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -18,6 +20,14 @@ class OutputEnvTest < Test::Unit::TestCase
|
|||||||
should "output MAILTO environment variable" do
|
should "output MAILTO environment variable" do
|
||||||
assert_match "MAILTO=someone@example.com", @output
|
assert_match "MAILTO=someone@example.com", @output
|
||||||
end
|
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
|
||||||
|
|
||||||
end
|
end
|
Loading…
Reference in New Issue
Block a user