diff --git a/lib/whenever/job_list.rb b/lib/whenever/job_list.rb index b04104d..444137a 100644 --- a/lib/whenever/job_list.rb +++ b/lib/whenever/job_list.rb @@ -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" diff --git a/test/functional/output_env_test.rb b/test/functional/output_env_test.rb index 2dd3fa7..320a676 100644 --- a/test/functional/output_env_test.rb +++ b/test/functional/output_env_test.rb @@ -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 \ No newline at end of file +end