rufus-scheduler 3.0.7 → 3.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/spec/spec_helper.rb CHANGED
@@ -5,12 +5,26 @@
5
5
  # Wed Apr 17 06:00:59 JST 2013
6
6
  #
7
7
 
8
- Thread.abort_on_exception = true
8
+ puts "RUBY_VERSION: #{RUBY_VERSION}"
9
+ puts "RUBY_PLATFORM: #{RUBY_PLATFORM}"
9
10
 
11
+ Thread.abort_on_exception = true
10
12
 
11
13
  require 'stringio'
12
14
  require 'rufus-scheduler'
13
15
 
16
+ #
17
+ # misc helper methods
18
+
19
+ def ruby18?
20
+
21
+ !! RUBY_VERSION.match(/^1\.8\./)
22
+ end
23
+
24
+ def jruby?
25
+
26
+ !! RUBY_PLATFORM.match(/java/)
27
+ end
14
28
 
15
29
  def local(*args)
16
30
 
@@ -23,6 +37,16 @@ def utc(*args)
23
37
  Time.utc(*args)
24
38
  end
25
39
 
40
+ def ltz(tz, *args)
41
+
42
+ in_zone(tz) { Time.local(*args) }
43
+ end
44
+
45
+ def ltu(tz, *args)
46
+
47
+ in_zone(tz) { Time.local(*args) }.getutc
48
+ end
49
+
26
50
  def sleep_until_next_minute
27
51
 
28
52
  min = Time.now.min
@@ -47,6 +71,28 @@ ensure
47
71
  ENV['TZ'] = prev_tz
48
72
  end
49
73
 
74
+ def with_chronic(&block)
75
+
76
+ require 'chronic'
77
+
78
+ Object.const_set(:Khronic, Chronic) unless defined?(Khronic)
79
+ Object.const_set(:Chronic, Khronic) unless defined?(Chronic)
80
+
81
+ block.call
82
+
83
+ ensure
84
+
85
+ Object.send(:remove_const, :Chronic)
86
+ end
87
+
88
+ def without_chronic(&block) # for quick counter-tests ;-)
89
+
90
+ block.call
91
+ end
92
+
93
+
94
+ #
95
+ # matchers
50
96
 
51
97
  #require 'rspec/expectations'
52
98
 
@@ -72,6 +118,9 @@ RSpec::Matchers.define :be_within_1s_of do |expected|
72
118
  end
73
119
 
74
120
 
121
+ #
122
+ # configure
123
+
75
124
  #RSpec.configure do |config|
76
125
  #end
77
126
 
data/spec/threads_spec.rb CHANGED
@@ -21,7 +21,7 @@ describe Rufus::Scheduler do
21
21
 
22
22
  it 'starts with an empty thread pool' do
23
23
 
24
- @scheduler.work_threads.size.should == 0
24
+ expect(@scheduler.work_threads.size).to eq(0)
25
25
  end
26
26
 
27
27
  it 'does not cross the max_work_threads threshold' do
@@ -42,7 +42,7 @@ describe Rufus::Scheduler do
42
42
  # p t[:rufus_scheduler_job].class
43
43
  #end
44
44
 
45
- @scheduler.work_threads.size.should == 5
45
+ expect(@scheduler.work_threads.size).to eq(5)
46
46
  end
47
47
 
48
48
  it 'does not cross the max_work_threads threshold (overlap: false)' do
@@ -63,7 +63,7 @@ describe Rufus::Scheduler do
63
63
  # p t[:rufus_scheduler_job].class
64
64
  #end
65
65
 
66
- @scheduler.work_threads.size.should == 5
66
+ expect(@scheduler.work_threads.size).to eq(5)
67
67
  end
68
68
 
69
69
  it 'does not execute unscheduled jobs' do
@@ -89,7 +89,7 @@ describe Rufus::Scheduler do
89
89
 
90
90
  sleep(2)
91
91
 
92
- counter.should == 1
92
+ expect(counter).to eq(1)
93
93
  end
94
94
  end
95
95
  end
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: 3.0.7
4
+ version: 3.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-17 00:00:00.000000000 Z
12
+ date: 2014-06-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: tzinfo
@@ -59,6 +59,22 @@ dependencies:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: 2.13.0
62
+ - !ruby/object:Gem::Dependency
63
+ name: chronic
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
62
78
  description: job scheduler for Ruby (at, cron, in and every jobs).
63
79
  email:
64
80
  - jmettraux@gmail.com
@@ -92,6 +108,7 @@ files:
92
108
  - spec/parse_spec.rb
93
109
  - spec/scheduler_spec.rb
94
110
  - spec/custom_locks_spec.rb
111
+ - spec/basics_spec.rb
95
112
  - spec/job_cron_spec.rb
96
113
  - spec/job_every_spec.rb
97
114
  - rufus-scheduler.gemspec
@@ -103,7 +120,7 @@ files:
103
120
  homepage: http://github.com/jmettraux/rufus-scheduler
104
121
  licenses:
105
122
  - MIT
106
- post_install_message: ! "\n***\n\nThanks for installing rufus-scheduler 3.0.7\n\nIt
123
+ post_install_message: ! "\n***\n\nThanks for installing rufus-scheduler 3.0.8\n\nIt
107
124
  might not be 100% compatible with rufus-scheduler 2.x.\n\nIf you encounter issues
108
125
  with this new rufus-scheduler, especially\nif your app worked fine with previous
109
126
  versions of it, you can\n\nA) Forget it and peg your Gemfile to rufus-scheduler
@@ -119,18 +136,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
136
  - - ! '>='
120
137
  - !ruby/object:Gem::Version
121
138
  version: '0'
122
- segments:
123
- - 0
124
- hash: -1141686396098710527
125
139
  required_rubygems_version: !ruby/object:Gem::Requirement
126
140
  none: false
127
141
  requirements:
128
142
  - - ! '>='
129
143
  - !ruby/object:Gem::Version
130
144
  version: '0'
131
- segments:
132
- - 0
133
- hash: -1141686396098710527
134
145
  requirements: []
135
146
  rubyforge_project: rufus
136
147
  rubygems_version: 1.8.23