Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Default the timing options if they are not specified

  • Loading branch information...
commit bc689723a21b364015d1c112cb744dd437b8750d 1 parent a88babd
@halorgium halorgium authored
View
2  lib/crondle/builder.rb
@@ -5,7 +5,7 @@ def desc(desc)
@next_desc = desc
end
- def job(cmd, options)
+ def job(cmd, options = {})
jobs << Job.new(next_desc, cmd, options)
end
View
2  lib/crondle/job.rb
@@ -12,7 +12,7 @@ class InvalidTimingParamError < StandardError; end
attr_accessor :description,
:cmd
- def initialize(description, cmd, timing_options)
+ def initialize(description, cmd, timing_options = {})
self.description = description
self.cmd = cmd
set_timing_options(timing_options)
View
4 spec/crondle/job_spec.rb
@@ -52,6 +52,10 @@ module Crondle
Job.new("desc", "ls", {}).to_s.count("*").should equal(5)
end
+ it "should allow only 2 arguments" do
+ Job.new("desc", "ls").to_s.count("*").should equal(5)
+ end
+
it "should work if day_of_week is a symbol OR a string" do
lambda {Job.new("desc", "ls", :day_of_week => :monday)}.should_not raise_error(Job::InvalidTimingParamError)
lambda {Job.new("desc", "ls", :day_of_week => 'monday')}.should_not raise_error(Job::InvalidTimingParamError)
Please sign in to comment.
Something went wrong with that request. Please try again.