clockwork-test 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +5 -3
- data/Appraisals +4 -0
- data/CHANGELOG.md +26 -0
- data/README.md +6 -2
- data/RELEASE_PROCESS.md +6 -0
- data/clockwork-test.gemspec +1 -0
- data/gemfiles/clockwork_1_3_1.gemfile.lock +4 -3
- data/gemfiles/clockwork_2_0_0.gemfile.lock +4 -3
- data/gemfiles/clockwork_2_0_1.gemfile.lock +4 -3
- data/gemfiles/clockwork_2_0_2.gemfile.lock +4 -3
- data/gemfiles/clockwork_2_0_3.gemfile +8 -0
- data/gemfiles/clockwork_2_0_3.gemfile.lock +70 -0
- data/gemfiles/clockwork_master.gemfile +8 -0
- data/gemfiles/clockwork_master.gemfile.lock +75 -0
- data/lib/clockwork/test.rb +6 -6
- data/lib/clockwork/test/manager.rb +21 -11
- data/lib/clockwork/test/version.rb +1 -1
- data/spec/acceptance/clock_spec.rb +16 -0
- data/spec/clockwork/test/manager_spec.rb +19 -0
- data/spec/fixtures/clock.rb +4 -0
- data/spec/spec_helper.rb +5 -4
- metadata +22 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0720316ef603e9190a19ebfd87639c2f8db3f5606f809fcae5d82719624ef300
|
4
|
+
data.tar.gz: bebe9b55cfba6288e3d06331edab3196ba2c42434aaa2b830e097d9afd2d59c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9838b238b123348e3d692fbbdc799659997e972722006d751f46660b896a1a5536c2854c3ff85c0050009df69a6ab3ba7956a1aff3b8d3cf7fa3dc378519ea24
|
7
|
+
data.tar.gz: 5ba2548b8f6e6bc0846cda612930728a010542564f25da59f227b7b7ff353f8134f85ea52990de7a8b5a134b5a2ff9917f7dbf3542f558f20308d9f5570472f3
|
data/.travis.yml
CHANGED
@@ -2,9 +2,9 @@ sudo: false
|
|
2
2
|
language: ruby
|
3
3
|
cache: bundler
|
4
4
|
rvm:
|
5
|
-
- 2.2.
|
6
|
-
- 2.3.
|
7
|
-
- 2.4.
|
5
|
+
- 2.2.9
|
6
|
+
- 2.3.6
|
7
|
+
- 2.4.3
|
8
8
|
- ruby-head
|
9
9
|
script:
|
10
10
|
- bundle exec rspec
|
@@ -12,7 +12,9 @@ matrix:
|
|
12
12
|
allow_failures:
|
13
13
|
- rvm: ruby-head
|
14
14
|
gemfile:
|
15
|
+
- gemfiles/clockwork_master.gemfile
|
15
16
|
- gemfiles/clockwork_1_3_1.gemfile
|
16
17
|
- gemfiles/clockwork_2_0_0.gemfile
|
17
18
|
- gemfiles/clockwork_2_0_1.gemfile
|
18
19
|
- gemfiles/clockwork_2_0_2.gemfile
|
20
|
+
- gemfiles/clockwork_2_0_3.gemfile
|
data/Appraisals
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,31 @@
|
|
1
1
|
## Current release (in development)
|
2
2
|
|
3
|
+
## 0.3.0 [2018-06-19]
|
4
|
+
|
5
|
+
* Introduce release process documentation [#14](https://github.com/kevin-j-m/clockwork-test/pull/14)
|
6
|
+
|
7
|
+
*Kevin Murphy*
|
8
|
+
|
9
|
+
* Test against master branch of clockwork [#18](https://github.com/kevin-j-m/clockwork-test/pull/18)
|
10
|
+
|
11
|
+
*Kevin Murphy*
|
12
|
+
|
13
|
+
* Add activesupport as dev dependency [#19](https://github.com/kevin-j-m/clockwork-test/pull/19)
|
14
|
+
|
15
|
+
*Kevin Murphy*
|
16
|
+
|
17
|
+
* Update ruby point versions in testing matrix [#22](https://github.com/kevin-j-m/clockwork-test/pull/22)
|
18
|
+
|
19
|
+
*Kevin Murphy*
|
20
|
+
|
21
|
+
* Add clockwork 2.0.3, support `skip_first_run` option [#25](https://github.com/kevin-j-m/clockwork-test/pull/25)
|
22
|
+
|
23
|
+
*[Oleksandr Rozumii](https://github.com/brain-geek)*
|
24
|
+
|
25
|
+
* Default `end_time` to current time if `start_time` is provided with no end time [#26](https://github.com/kevin-j-m/clockwork-test/pull/26)
|
26
|
+
|
27
|
+
*[Oleksandr Rozumii](https://github.com/brain-geek)*
|
28
|
+
|
3
29
|
## 0.2.0
|
4
30
|
|
5
31
|
* Refactor custom matcher to remove repeated code [#8](https://github.com/kevin-j-m/clockwork-test/pull/8)
|
data/README.md
CHANGED
@@ -51,6 +51,8 @@ end
|
|
51
51
|
The following tests may be run against it:
|
52
52
|
|
53
53
|
```ruby
|
54
|
+
require "clockwork/test"
|
55
|
+
|
54
56
|
describe Clockwork do
|
55
57
|
after(:each) { Clockwork::Test.clear! }
|
56
58
|
|
@@ -67,9 +69,9 @@ describe Clockwork do
|
|
67
69
|
end_time = Time.new(2015, 11, 2, 3, 0, 0)
|
68
70
|
|
69
71
|
Clockwork::Test.run(start_time: start_time, end_time: end_time, tick_speed:
|
70
|
-
1.minute)
|
72
|
+
1.minute)
|
71
73
|
|
72
|
-
expect(Clockwork::Test.times_run("Run a job").to eq 60
|
74
|
+
expect(Clockwork::Test.times_run("Run a job")).to eq 60
|
73
75
|
end
|
74
76
|
|
75
77
|
describe "RSpec Custom Matcher" do
|
@@ -116,6 +118,8 @@ This specifies the time at which execution of clockwork should terminate. The ru
|
|
116
118
|
|
117
119
|
This is commonly used along with `start_time` and `tick_speed` to quickly see if jobs run as often as expected over a certain period of time.
|
118
120
|
|
121
|
+
When `start_time` is set, this setting defaults to `Time.current`.
|
122
|
+
|
119
123
|
#### tick_speed
|
120
124
|
|
121
125
|
`tick_speed` should be provided as a unit of time, such as `1.minute` or `3.hours`. It is the amount of time that the test will progress time to on every subsequent clock tick.
|
data/RELEASE_PROCESS.md
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
* Bump version number in `lib/clockwork/test/version.rb`.
|
2
|
+
* Update the [CHANGELOG](CHANGELOG.md), moving the current release work to under the version number.
|
3
|
+
* Update appraisal gemfiles with the new version number `appraisal install`.
|
4
|
+
* Run tests across all clockwork versions `appraisal rake`.
|
5
|
+
* Push the release to RubyGems `rake release`.
|
6
|
+
* Check the RubyGems [twitter account](https://twitter.com/rubygems) to publicize the release.
|
data/clockwork-test.gemspec
CHANGED
@@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
+
spec.add_development_dependency "activesupport"
|
21
22
|
spec.add_development_dependency "bundler", "~> 1.7"
|
22
23
|
spec.add_development_dependency "pry"
|
23
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
clockwork-test (0.
|
4
|
+
clockwork-test (0.3.0)
|
5
5
|
clockwork
|
6
6
|
timecop
|
7
7
|
|
@@ -50,7 +50,7 @@ GEM
|
|
50
50
|
slop (3.6.0)
|
51
51
|
thor (0.19.4)
|
52
52
|
thread_safe (0.3.6)
|
53
|
-
timecop (0.
|
53
|
+
timecop (0.9.1)
|
54
54
|
tzinfo (1.2.3)
|
55
55
|
thread_safe (~> 0.1)
|
56
56
|
|
@@ -58,6 +58,7 @@ PLATFORMS
|
|
58
58
|
ruby
|
59
59
|
|
60
60
|
DEPENDENCIES
|
61
|
+
activesupport
|
61
62
|
appraisal
|
62
63
|
bundler (~> 1.7)
|
63
64
|
clockwork (= 1.3.1)
|
@@ -68,4 +69,4 @@ DEPENDENCIES
|
|
68
69
|
rspec-its
|
69
70
|
|
70
71
|
BUNDLED WITH
|
71
|
-
1.
|
72
|
+
1.16.2
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
clockwork-test (0.
|
4
|
+
clockwork-test (0.3.0)
|
5
5
|
clockwork
|
6
6
|
timecop
|
7
7
|
|
@@ -50,7 +50,7 @@ GEM
|
|
50
50
|
slop (3.6.0)
|
51
51
|
thor (0.19.4)
|
52
52
|
thread_safe (0.3.6)
|
53
|
-
timecop (0.
|
53
|
+
timecop (0.9.1)
|
54
54
|
tzinfo (1.2.3)
|
55
55
|
thread_safe (~> 0.1)
|
56
56
|
|
@@ -58,6 +58,7 @@ PLATFORMS
|
|
58
58
|
ruby
|
59
59
|
|
60
60
|
DEPENDENCIES
|
61
|
+
activesupport
|
61
62
|
appraisal
|
62
63
|
bundler (~> 1.7)
|
63
64
|
clockwork (= 2.0.0)
|
@@ -68,4 +69,4 @@ DEPENDENCIES
|
|
68
69
|
rspec-its
|
69
70
|
|
70
71
|
BUNDLED WITH
|
71
|
-
1.
|
72
|
+
1.16.2
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
clockwork-test (0.
|
4
|
+
clockwork-test (0.3.0)
|
5
5
|
clockwork
|
6
6
|
timecop
|
7
7
|
|
@@ -50,7 +50,7 @@ GEM
|
|
50
50
|
slop (3.6.0)
|
51
51
|
thor (0.19.4)
|
52
52
|
thread_safe (0.3.6)
|
53
|
-
timecop (0.
|
53
|
+
timecop (0.9.1)
|
54
54
|
tzinfo (1.2.3)
|
55
55
|
thread_safe (~> 0.1)
|
56
56
|
|
@@ -58,6 +58,7 @@ PLATFORMS
|
|
58
58
|
ruby
|
59
59
|
|
60
60
|
DEPENDENCIES
|
61
|
+
activesupport
|
61
62
|
appraisal
|
62
63
|
bundler (~> 1.7)
|
63
64
|
clockwork (= 2.0.1)
|
@@ -68,4 +69,4 @@ DEPENDENCIES
|
|
68
69
|
rspec-its
|
69
70
|
|
70
71
|
BUNDLED WITH
|
71
|
-
1.
|
72
|
+
1.16.2
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
clockwork-test (0.
|
4
|
+
clockwork-test (0.3.0)
|
5
5
|
clockwork
|
6
6
|
timecop
|
7
7
|
|
@@ -50,7 +50,7 @@ GEM
|
|
50
50
|
slop (3.6.0)
|
51
51
|
thor (0.19.4)
|
52
52
|
thread_safe (0.3.6)
|
53
|
-
timecop (0.
|
53
|
+
timecop (0.9.1)
|
54
54
|
tzinfo (1.2.3)
|
55
55
|
thread_safe (~> 0.1)
|
56
56
|
|
@@ -58,6 +58,7 @@ PLATFORMS
|
|
58
58
|
ruby
|
59
59
|
|
60
60
|
DEPENDENCIES
|
61
|
+
activesupport
|
61
62
|
appraisal
|
62
63
|
bundler (~> 1.7)
|
63
64
|
clockwork (= 2.0.2)
|
@@ -68,4 +69,4 @@ DEPENDENCIES
|
|
68
69
|
rspec-its
|
69
70
|
|
70
71
|
BUNDLED WITH
|
71
|
-
1.
|
72
|
+
1.16.2
|
@@ -0,0 +1,70 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
clockwork-test (0.2.0)
|
5
|
+
clockwork
|
6
|
+
timecop
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
activesupport (5.2.0)
|
12
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
|
+
i18n (>= 0.7, < 2)
|
14
|
+
minitest (~> 5.1)
|
15
|
+
tzinfo (~> 1.1)
|
16
|
+
appraisal (2.2.0)
|
17
|
+
bundler
|
18
|
+
rake
|
19
|
+
thor (>= 0.14.0)
|
20
|
+
clockwork (2.0.3)
|
21
|
+
tzinfo
|
22
|
+
coderay (1.1.2)
|
23
|
+
concurrent-ruby (1.0.5)
|
24
|
+
diff-lcs (1.3)
|
25
|
+
i18n (1.0.1)
|
26
|
+
concurrent-ruby (~> 1.0)
|
27
|
+
method_source (0.9.0)
|
28
|
+
minitest (5.11.3)
|
29
|
+
pry (0.11.3)
|
30
|
+
coderay (~> 1.1.0)
|
31
|
+
method_source (~> 0.9.0)
|
32
|
+
rake (10.5.0)
|
33
|
+
rspec (3.7.0)
|
34
|
+
rspec-core (~> 3.7.0)
|
35
|
+
rspec-expectations (~> 3.7.0)
|
36
|
+
rspec-mocks (~> 3.7.0)
|
37
|
+
rspec-core (3.7.1)
|
38
|
+
rspec-support (~> 3.7.0)
|
39
|
+
rspec-expectations (3.7.0)
|
40
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
41
|
+
rspec-support (~> 3.7.0)
|
42
|
+
rspec-its (1.2.0)
|
43
|
+
rspec-core (>= 3.0.0)
|
44
|
+
rspec-expectations (>= 3.0.0)
|
45
|
+
rspec-mocks (3.7.0)
|
46
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
47
|
+
rspec-support (~> 3.7.0)
|
48
|
+
rspec-support (3.7.1)
|
49
|
+
thor (0.20.0)
|
50
|
+
thread_safe (0.3.6)
|
51
|
+
timecop (0.9.1)
|
52
|
+
tzinfo (1.2.5)
|
53
|
+
thread_safe (~> 0.1)
|
54
|
+
|
55
|
+
PLATFORMS
|
56
|
+
ruby
|
57
|
+
|
58
|
+
DEPENDENCIES
|
59
|
+
activesupport
|
60
|
+
appraisal
|
61
|
+
bundler (~> 1.7)
|
62
|
+
clockwork (= 2.0.3)
|
63
|
+
clockwork-test!
|
64
|
+
pry
|
65
|
+
rake (~> 10.0)
|
66
|
+
rspec
|
67
|
+
rspec-its
|
68
|
+
|
69
|
+
BUNDLED WITH
|
70
|
+
1.16.0.pre.3
|
@@ -0,0 +1,75 @@
|
|
1
|
+
GIT
|
2
|
+
remote: https://github.com/Rykian/clockwork
|
3
|
+
revision: 11f80a0f206d17060b07a55bffec23e935279d1c
|
4
|
+
specs:
|
5
|
+
clockwork (2.0.2)
|
6
|
+
tzinfo
|
7
|
+
|
8
|
+
PATH
|
9
|
+
remote: ..
|
10
|
+
specs:
|
11
|
+
clockwork-test (0.3.0)
|
12
|
+
clockwork
|
13
|
+
timecop
|
14
|
+
|
15
|
+
GEM
|
16
|
+
remote: https://rubygems.org/
|
17
|
+
specs:
|
18
|
+
activesupport (5.1.4)
|
19
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
20
|
+
i18n (~> 0.7)
|
21
|
+
minitest (~> 5.1)
|
22
|
+
tzinfo (~> 1.1)
|
23
|
+
appraisal (2.2.0)
|
24
|
+
bundler
|
25
|
+
rake
|
26
|
+
thor (>= 0.14.0)
|
27
|
+
coderay (1.1.2)
|
28
|
+
concurrent-ruby (1.0.5)
|
29
|
+
diff-lcs (1.3)
|
30
|
+
i18n (0.9.1)
|
31
|
+
concurrent-ruby (~> 1.0)
|
32
|
+
method_source (0.9.0)
|
33
|
+
minitest (5.10.3)
|
34
|
+
pry (0.11.3)
|
35
|
+
coderay (~> 1.1.0)
|
36
|
+
method_source (~> 0.9.0)
|
37
|
+
rake (10.5.0)
|
38
|
+
rspec (3.7.0)
|
39
|
+
rspec-core (~> 3.7.0)
|
40
|
+
rspec-expectations (~> 3.7.0)
|
41
|
+
rspec-mocks (~> 3.7.0)
|
42
|
+
rspec-core (3.7.0)
|
43
|
+
rspec-support (~> 3.7.0)
|
44
|
+
rspec-expectations (3.7.0)
|
45
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
46
|
+
rspec-support (~> 3.7.0)
|
47
|
+
rspec-its (1.2.0)
|
48
|
+
rspec-core (>= 3.0.0)
|
49
|
+
rspec-expectations (>= 3.0.0)
|
50
|
+
rspec-mocks (3.7.0)
|
51
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
52
|
+
rspec-support (~> 3.7.0)
|
53
|
+
rspec-support (3.7.0)
|
54
|
+
thor (0.20.0)
|
55
|
+
thread_safe (0.3.6)
|
56
|
+
timecop (0.9.1)
|
57
|
+
tzinfo (1.2.4)
|
58
|
+
thread_safe (~> 0.1)
|
59
|
+
|
60
|
+
PLATFORMS
|
61
|
+
ruby
|
62
|
+
|
63
|
+
DEPENDENCIES
|
64
|
+
activesupport
|
65
|
+
appraisal
|
66
|
+
bundler (~> 1.7)
|
67
|
+
clockwork!
|
68
|
+
clockwork-test!
|
69
|
+
pry
|
70
|
+
rake (~> 10.0)
|
71
|
+
rspec
|
72
|
+
rspec-its
|
73
|
+
|
74
|
+
BUNDLED WITH
|
75
|
+
1.16.2
|
data/lib/clockwork/test.rb
CHANGED
@@ -50,12 +50,12 @@ module Clockwork
|
|
50
50
|
tick_speed: opts[:tick_speed]
|
51
51
|
}
|
52
52
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
53
|
+
manager.run(run_opts) do
|
54
|
+
# TODO parse file rather than loading it
|
55
|
+
# and overloading Clockwork::Methods::every
|
56
|
+
# and Clockwork::Methods::configure
|
57
|
+
load file
|
58
|
+
end
|
59
59
|
end
|
60
60
|
|
61
61
|
def clear!
|
@@ -1,30 +1,27 @@
|
|
1
1
|
module Clockwork
|
2
2
|
module Test
|
3
3
|
class Manager < Clockwork::Manager
|
4
|
-
attr_reader :total_ticks, :max_ticks, :end_time
|
4
|
+
attr_reader :total_ticks, :max_ticks, :end_time, :start_time
|
5
5
|
|
6
6
|
def initialize(opts = {})
|
7
7
|
super()
|
8
8
|
@history = JobHistory.new
|
9
|
-
|
10
9
|
@total_ticks = 0
|
11
|
-
|
12
|
-
|
13
|
-
@end_time = opts[:end_time]
|
10
|
+
set_opts(opts)
|
11
|
+
|
14
12
|
config[:logger].level = Logger::ERROR
|
15
13
|
end
|
16
14
|
|
17
15
|
def run(opts = {})
|
18
|
-
|
19
|
-
@start_time = opts[:start_time] if opts[:start_time]
|
20
|
-
@end_time = opts[:end_time] if opts[:end_time]
|
21
|
-
@tick_speed = opts[:tick_speed]
|
16
|
+
set_opts(opts)
|
22
17
|
|
23
|
-
if
|
18
|
+
if start_time
|
24
19
|
@time_altered = true
|
25
|
-
Timecop.travel(
|
20
|
+
Timecop.travel(start_time)
|
26
21
|
end
|
27
22
|
|
23
|
+
yield if block_given?
|
24
|
+
|
28
25
|
tick_loop
|
29
26
|
|
30
27
|
Timecop.return if @time_altered
|
@@ -44,6 +41,19 @@ module Clockwork
|
|
44
41
|
|
45
42
|
private
|
46
43
|
|
44
|
+
def set_opts(opts)
|
45
|
+
@max_ticks = opts[:max_ticks] if opts[:max_ticks]
|
46
|
+
@start_time = opts[:start_time] if opts[:start_time]
|
47
|
+
if opts[:end_time]
|
48
|
+
@end_time = opts[:end_time]
|
49
|
+
elsif @start_time
|
50
|
+
@end_time = Time.current
|
51
|
+
end
|
52
|
+
@tick_speed = opts[:tick_speed]
|
53
|
+
|
54
|
+
raise "End time can't precede start time." if @start_time && (@start_time > @end_time)
|
55
|
+
end
|
56
|
+
|
47
57
|
attr_reader :history
|
48
58
|
|
49
59
|
def tick_loop
|
@@ -76,4 +76,20 @@ describe "Clockwork" do
|
|
76
76
|
it { should_not have_run("Run at certain time") }
|
77
77
|
end
|
78
78
|
end
|
79
|
+
|
80
|
+
if Gem::Version.new("2.0.2") < Gem::Version.new(Gem.loaded_specs["clockwork"].version)
|
81
|
+
describe "Runs when skip_first_run is specified" do
|
82
|
+
subject(:clockwork) { Clockwork::Test }
|
83
|
+
|
84
|
+
before(:each) { Clockwork::Test.run(clock_opts) }
|
85
|
+
after(:each) { Clockwork::Test.clear! }
|
86
|
+
|
87
|
+
let(:start_time) { Time.new(2012, 9, 1, 17, 30, 0) }
|
88
|
+
let(:end_time) { start_time + 25.hours }
|
89
|
+
|
90
|
+
let(:clock_opts) { { file: clock_file, start_time: start_time, end_time: end_time, tick_speed: 12.hours } }
|
91
|
+
|
92
|
+
it { should have_run("Run but not at start").once }
|
93
|
+
end
|
94
|
+
end
|
79
95
|
end
|
@@ -8,6 +8,7 @@ describe Clockwork::Test::Manager do
|
|
8
8
|
context "initial state" do
|
9
9
|
its(:total_ticks) { should eq 0 }
|
10
10
|
its(:max_ticks) { should be_nil }
|
11
|
+
its(:start_time) { should be_nil }
|
11
12
|
its(:end_time) { should be_nil }
|
12
13
|
|
13
14
|
context "providing a maximum number of ticks" do
|
@@ -23,6 +24,24 @@ describe Clockwork::Test::Manager do
|
|
23
24
|
|
24
25
|
its(:end_time) { should eq end_time }
|
25
26
|
end
|
27
|
+
|
28
|
+
context "start_time provided, while end_time is not" do
|
29
|
+
let(:opts) { { start_time: 5.minutes.ago } }
|
30
|
+
|
31
|
+
before { Timecop.freeze }
|
32
|
+
after { Timecop.return }
|
33
|
+
|
34
|
+
its(:start_time) { should eq opts[:start_time] }
|
35
|
+
its(:end_time) { should eq Time.current }
|
36
|
+
end
|
37
|
+
|
38
|
+
context "start_time happens after the end_time" do
|
39
|
+
let(:opts) { { start_time: 5.minutes.ago, end_time: 10.minutes.ago } }
|
40
|
+
|
41
|
+
it "raises with useful message" do
|
42
|
+
expect { manager }.to raise_error("End time can't precede start time.")
|
43
|
+
end
|
44
|
+
end
|
26
45
|
end
|
27
46
|
|
28
47
|
describe "#run" do
|
data/spec/fixtures/clock.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
$LOAD_PATH.unshift File.expand_path(
|
2
|
-
require
|
1
|
+
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
|
2
|
+
require "clockwork/test"
|
3
3
|
|
4
|
-
require
|
5
|
-
require
|
4
|
+
require "active_support/time"
|
5
|
+
require "pry"
|
6
|
+
require "rspec/its"
|
6
7
|
|
7
8
|
RSpec.configure do |config|
|
8
9
|
config.include(Clockwork::Test::RSpec::Matchers)
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clockwork-test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Murphy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bundler
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,6 +137,7 @@ files:
|
|
123
137
|
- Gemfile
|
124
138
|
- LICENSE.txt
|
125
139
|
- README.md
|
140
|
+
- RELEASE_PROCESS.md
|
126
141
|
- Rakefile
|
127
142
|
- clockwork-test.gemspec
|
128
143
|
- gemfiles/clockwork_1_3_1.gemfile
|
@@ -133,6 +148,10 @@ files:
|
|
133
148
|
- gemfiles/clockwork_2_0_1.gemfile.lock
|
134
149
|
- gemfiles/clockwork_2_0_2.gemfile
|
135
150
|
- gemfiles/clockwork_2_0_2.gemfile.lock
|
151
|
+
- gemfiles/clockwork_2_0_3.gemfile
|
152
|
+
- gemfiles/clockwork_2_0_3.gemfile.lock
|
153
|
+
- gemfiles/clockwork_master.gemfile
|
154
|
+
- gemfiles/clockwork_master.gemfile.lock
|
136
155
|
- lib/clockwork/test.rb
|
137
156
|
- lib/clockwork/test/event.rb
|
138
157
|
- lib/clockwork/test/job_history.rb
|
@@ -166,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
185
|
version: '0'
|
167
186
|
requirements: []
|
168
187
|
rubyforge_project:
|
169
|
-
rubygems_version: 2.
|
188
|
+
rubygems_version: 2.7.7
|
170
189
|
signing_key:
|
171
190
|
specification_version: 4
|
172
191
|
summary: Test clockwork scheduled jobs
|