forked from gnufied/backgroundrb
/
cron_trigger_test.rb
53 lines (38 loc) · 1.26 KB
/
cron_trigger_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
require File.join(File.dirname(__FILE__) + "/bdrb_test_helper")
require "meta_worker"
context "Cron Trigger should" do
setup do
BackgrounDRb::MetaWorker.worker_name = "hello_worker"
class BackgrounDRb::MetaWorker
attr_accessor :outgoing_data
attr_accessor :incoming_data
def send_data(data)
@outgoing_data = data
end
def ivar var
instance_variable_get(:"@#{var}")
end
def start_reactor; end
end
@klass = BackgrounDRb::MetaWorker
end
specify "run task each second for no option" do
t_arg = { :foo => { :trigger_args => "*/5 * * * * *"}}
@klass.any_instance.stubs(:worker_options).returns(:schedule => t_arg)
meta_worker = @klass.start_worker
meta_worker.ivar(:my_schedule).should.not.be(nil)
meta_worker.ivar(:my_schedule).should == t_arg
end
xspecify "run task each minute for minute option" do
end
xspecify "run at specified hour for hourly option" do
end
xspecify "run at specified day for day option" do
end
xspecify "run at specified week day for specified option" do
end
xspecify "run in appropriate month for speficied option" do
end
xspecify "run in appropriate year for specified option" do
end
end