whenever/test/output_command_test.rb

37 lines
780 B
Ruby
Raw Normal View History

require File.expand_path(File.dirname(__FILE__) + "/test_helper")
2009-02-16 03:24:10 +00:00
class OutputCommandTest < Test::Unit::TestCase
context "A plain command" do
setup do
@output = Whenever.cron \
2009-02-16 03:24:10 +00:00
<<-file
every 2.hours do
command "blahblah"
end
file
end
should "output the command" do
assert_match /^.+ .+ .+ .+ blahblah$/, @output
end
end
context "An every statement with two commands in it" do
setup do
@output = Whenever.cron \
<<-file
every 1.hour do
command "first"
command "second"
end
file
end
should "output both commands" do
assert_match "0 * * * * first", @output
assert_match "0 * * * * second", @output
end
end
2009-02-16 03:24:10 +00:00
end