rufus-scheduler 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,7 +7,6 @@
7
7
  # Sun Oct 29 16:18:25 JST 2006
8
8
  #
9
9
 
10
- require 'pp'
11
10
  require 'test/unit'
12
11
 
13
12
  require 'rufus/scheduler'
@@ -62,7 +62,7 @@ class Scheduler0Test < Test::Unit::TestCase
62
62
  scheduler = Rufus::Scheduler.new
63
63
  scheduler.start
64
64
 
65
- sid = scheduler.schedule_in('1s') do
65
+ sid = scheduler.in('1s') do
66
66
  $var = "ok..1"
67
67
  end
68
68
 
@@ -144,7 +144,7 @@ class Scheduler0Test < Test::Unit::TestCase
144
144
 
145
145
  es = EverySchedulable.new
146
146
 
147
- job_id = scheduler.schedule_every "500", es
147
+ job_id = scheduler.every "500", es
148
148
 
149
149
  #puts "1 job_id : " + job_id.to_s
150
150
 
@@ -160,6 +160,9 @@ class Scheduler0Test < Test::Unit::TestCase
160
160
 
161
161
  assert_equal 6, es.count
162
162
 
163
+ assert_nil scheduler.get_job(job_id)
164
+ assert_equal 1, scheduler.every_job_count # one left from before
165
+
163
166
  # done
164
167
 
165
168
  scheduler.sstop
@@ -265,12 +268,11 @@ class Scheduler0Test < Test::Unit::TestCase
265
268
  #
266
269
  def test_8b
267
270
 
268
- scheduler = Rufus::Scheduler.new
269
- scheduler.start
271
+ scheduler = Rufus::Scheduler.start_new
270
272
 
271
273
  var = nil
272
274
 
273
- job_id = scheduler.schedule_at(Time.now.to_s, :discard_past => true) do
275
+ job_id = scheduler.at(Time.now.to_s, :discard_past => true) do
274
276
  var = "something"
275
277
  end
276
278
 
@@ -47,8 +47,7 @@ class Scheduler1Test < Test::Unit::TestCase
47
47
 
48
48
  def test_1
49
49
 
50
- scheduler = Rufus::Scheduler.new
51
- scheduler.start
50
+ scheduler = Rufus::Scheduler.start_new
52
51
 
53
52
  job_id = scheduler.schedule_every "500", :tags => "Avery" do
54
53
  # don't do a thing
@@ -59,8 +58,8 @@ class Scheduler1Test < Test::Unit::TestCase
59
58
  count = 1
60
59
 
61
60
  200_000.times do
62
- #assert_equal 1, scheduler.find_jobs("Avery").size
63
61
  count = scheduler.find_jobs("Avery").size
62
+ #p scheduler.instance_variable_get(:@non_cron_jobs).keys if count != 1
64
63
  break if count != 1
65
64
  end
66
65
 
@@ -74,8 +73,7 @@ class Scheduler1Test < Test::Unit::TestCase
74
73
  #
75
74
  def _test_2
76
75
 
77
- scheduler = Rufus::Scheduler.new
78
- scheduler.start
76
+ scheduler = Rufus::Scheduler.start_new
79
77
  last = nil
80
78
  job_id = scheduler.schedule_every "1s" do
81
79
  t = Time.now
@@ -41,7 +41,7 @@ class Scheduler3Test < Test::Unit::TestCase
41
41
  scheduler.schedule "* * * * *", :tags => "fish" do
42
42
  value = "cron-fish"
43
43
  end
44
- scheduler.schedule "* * * * *", :tags => "vegetable" do
44
+ scheduler.cron "* * * * *", :tags => "vegetable" do
45
45
  value = "daikon"
46
46
  end
47
47
 
@@ -47,7 +47,7 @@ class Scheduler4Test < Test::Unit::TestCase
47
47
  end
48
48
  #p Time.now.to_f
49
49
 
50
- sleep 10.300
50
+ sleep 10.600
51
51
 
52
52
  s.stop
53
53
 
@@ -0,0 +1,51 @@
1
+
2
+ #
3
+ # Testing the 'rufus-scheduler'
4
+ #
5
+ # John Mettraux at openwfe.org
6
+ #
7
+ # Sun Jul 13 19:20:27 JST 2008
8
+ #
9
+
10
+ require 'test/unit'
11
+ require 'rufus/scheduler'
12
+
13
+
14
+ #
15
+ # checking if bug #20893 got fixed
16
+ #
17
+
18
+ class Scheduler7Test < Test::Unit::TestCase
19
+
20
+ #def setup
21
+ #end
22
+
23
+ #def teardown
24
+ #end
25
+
26
+ def test_0
27
+
28
+ count = 0
29
+
30
+ s = Rufus::Scheduler.start_new
31
+
32
+ job_id = s.schedule_every('5s') do |job_id, at, params|
33
+ count += 1
34
+ sleep 3
35
+ end
36
+
37
+ sleep 6
38
+
39
+ assert_equal 1, s.every_job_count
40
+
41
+ s.unschedule job_id
42
+
43
+ sleep 6
44
+
45
+ s.stop
46
+
47
+ assert_equal 0, s.every_job_count
48
+ assert_equal 1, count
49
+ end
50
+ end
51
+
data/test/test.rb CHANGED
@@ -11,6 +11,7 @@ require 'scheduler_3_test'
11
11
  require 'scheduler_4_test'
12
12
  require 'scheduler_5_test'
13
13
  require 'scheduler_6_test'
14
+ require 'scheduler_7_test'
14
15
 
15
16
  require 'cron_test'
16
17
  require 'cronline_test'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rufus-scheduler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mettraux
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-06-17 00:00:00 +09:00
12
+ date: 2008-07-18 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -28,6 +28,7 @@ files:
28
28
  - lib/openwfe/util
29
29
  - lib/openwfe/util/scheduler.rb
30
30
  - lib/rufus
31
+ - lib/rufus/cronline.rb
31
32
  - lib/rufus/otime.rb
32
33
  - lib/rufus/scheduler.rb
33
34
  - test/cron_test.rb
@@ -40,6 +41,7 @@ files:
40
41
  - test/scheduler_4_test.rb
41
42
  - test/scheduler_5_test.rb
42
43
  - test/scheduler_6_test.rb
44
+ - test/scheduler_7_test.rb
43
45
  - test/scheduler_name_test.rb
44
46
  - test/test.rb
45
47
  - test/time_0_test.rb
@@ -69,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
71
  requirements: []
70
72
 
71
73
  rubyforge_project:
72
- rubygems_version: 1.1.0
74
+ rubygems_version: 1.2.0
73
75
  signing_key:
74
76
  specification_version: 2
75
77
  summary: scheduler for Ruby (at, cron and every jobs), formerly known as 'openwferu-scheduler'