2010-09-06 17:18:39 +00:00
|
|
|
require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
|
2009-02-16 03:24:10 +00:00
|
|
|
|
|
|
|
class OutputEnvTest < Test::Unit::TestCase
|
|
|
|
|
|
|
|
context "The output from Whenever with environment variables set" do
|
|
|
|
setup do
|
2009-02-17 00:22:37 +00:00
|
|
|
@output = Whenever.cron \
|
2009-02-16 03:24:10 +00:00
|
|
|
<<-file
|
|
|
|
env :MYVAR, 'blah'
|
|
|
|
env 'MAILTO', "someone@example.com"
|
2010-12-07 18:12:08 +00:00
|
|
|
env :BLANKVAR, ''
|
|
|
|
env :NILVAR, nil
|
2009-02-16 03:24:10 +00:00
|
|
|
file
|
|
|
|
end
|
|
|
|
|
|
|
|
should "output MYVAR environment variable" do
|
|
|
|
assert_match "MYVAR=blah", @output
|
|
|
|
end
|
|
|
|
|
|
|
|
should "output MAILTO environment variable" do
|
|
|
|
assert_match "MAILTO=someone@example.com", @output
|
|
|
|
end
|
2010-12-07 18:12:08 +00:00
|
|
|
|
|
|
|
should "output BLANKVAR environment variable" do
|
|
|
|
assert_match "BLANKVAR=\"\"", @output
|
|
|
|
end
|
|
|
|
|
|
|
|
should "output NILVAR environment variable" do
|
|
|
|
assert_match "NILVAR=\"\"", @output
|
|
|
|
end
|
2009-02-16 03:24:10 +00:00
|
|
|
end
|
|
|
|
|
2010-12-07 18:12:08 +00:00
|
|
|
end
|