File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ def job_type(name, template)
6666
6767 @jobs [ options . fetch ( :mailto ) ] ||= { }
6868 @jobs [ options . fetch ( :mailto ) ] [ @current_time_scope ] ||= [ ]
69- @jobs [ options . fetch ( :mailto ) ] [ @current_time_scope ] << Whenever ::Job . new ( @options . merge ( @set_variables ) . merge ( options ) )
69+ @jobs [ options . fetch ( :mailto ) ] [ @current_time_scope ] << Whenever ::Job . new ( @set_variables . merge ( @options ) . merge ( options ) )
7070 end
7171 end
7272 end
Original file line number Diff line number Diff line change @@ -55,6 +55,34 @@ class OutputDefinedJobTest < Whenever::TestCase
5555 assert_match ( /^.+ .+ .+ .+ before during after local$/ , output )
5656 end
5757
58+ test "defined job with a :task and an option where the option is set globally and on the group" do
59+ output = Whenever . cron \
60+ <<-file
61+ set :job_template, nil
62+ job_type :some_job, "before :task after :option1"
63+ set :option1, 'global'
64+ every 2.hours, :option1 => 'group' do
65+ some_job "during"
66+ end
67+ file
68+
69+ assert_match ( /^.+ .+ .+ .+ before during after group$/ , output )
70+ end
71+
72+ test "defined job with a :task and an option where the option is set globally, on the group, and locally" do
73+ output = Whenever . cron \
74+ <<-file
75+ set :job_template, nil
76+ job_type :some_job, "before :task after :option1"
77+ set :option1, 'global'
78+ every 2.hours, :option1 => 'group' do
79+ some_job "during", :option1 => 'local'
80+ end
81+ file
82+
83+ assert_match ( /^.+ .+ .+ .+ before during after local$/ , output )
84+ end
85+
5886 test "defined job with a :task and an option that is not set" do
5987 output = Whenever . cron \
6088 <<-file
You can’t perform that action at this time.
0 commit comments