fist_of_fury 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2572b7086d09ce10c1f14245a7687cb18e872c02
|
|
4
|
+
data.tar.gz: 624f7c8bfeac4e1774b9185c28a2aeba00db4afe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1578df1742fe9f2cec905e49505e7c2eb13689eb32517bd1cc1382118ae8e3311836577ec41e04dbdb3100c6e07372a7d92d33ecf4ce2d367fddc48724e37970
|
|
7
|
+
data.tar.gz: d5de6ae3f01a68f24e47015491cf93b79527c4f81782b4ffdf681a486922cb3ccb55c2c9db0ab8257126163b19e01ca48248129cc8313fcdae221d02ece7ac64
|
|
@@ -19,7 +19,7 @@ module FistOfFury
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def schedule_next(time)
|
|
22
|
-
return unless
|
|
22
|
+
return unless can_schedule_next?(time)
|
|
23
23
|
self.last_occurrence = next_occurrence(time)
|
|
24
24
|
yield
|
|
25
25
|
end
|
|
@@ -29,7 +29,7 @@ module FistOfFury
|
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def start_time
|
|
32
|
-
@start_time ||= FistOfFury.config.utc ? Time.utc
|
|
32
|
+
@start_time ||= FistOfFury.config.utc ? Time.now.utc : Time.now
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
private
|
|
@@ -38,7 +38,10 @@ module FistOfFury
|
|
|
38
38
|
ice_cube_schedule.next_occurrence(time)
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
-
def
|
|
41
|
+
def can_schedule_next?(time)
|
|
42
|
+
unless last_occurrence
|
|
43
|
+
self.last_occurrence = next_occurrence(time)
|
|
44
|
+
end
|
|
42
45
|
last_occurrence != next_occurrence(time)
|
|
43
46
|
end
|
|
44
47
|
end
|
data/lib/fist_of_fury/version.rb
CHANGED
|
@@ -12,7 +12,7 @@ shared_examples_for 'the api' do
|
|
|
12
12
|
it 'returns the worker schedules' do
|
|
13
13
|
worker_list = double('worker_list')
|
|
14
14
|
expect(worker_list).to receive(:map)
|
|
15
|
-
|
|
15
|
+
allow(described_class).to receive(:workers).and_return(worker_list)
|
|
16
16
|
subject.schedules
|
|
17
17
|
end
|
|
18
18
|
end
|
|
@@ -15,7 +15,7 @@ describe FistOfFury do
|
|
|
15
15
|
expect(config).to eq(config)
|
|
16
16
|
block_called = true
|
|
17
17
|
end
|
|
18
|
-
expect(block_called).to
|
|
18
|
+
expect(block_called).to eq true
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
|
|
@@ -32,7 +32,7 @@ describe FistOfFury do
|
|
|
32
32
|
expect(config).to eq(config)
|
|
33
33
|
block_called = true
|
|
34
34
|
end
|
|
35
|
-
expect(block_called).to
|
|
35
|
+
expect(block_called).to eq true
|
|
36
36
|
end
|
|
37
37
|
end
|
|
38
38
|
|
|
@@ -25,13 +25,13 @@ describe FistOfFury::Schedule do
|
|
|
25
25
|
|
|
26
26
|
context 'when it should be scheduled' do
|
|
27
27
|
before :each do
|
|
28
|
-
allow(schedule).to receive(:
|
|
28
|
+
allow(schedule).to receive(:can_schedule_next?).and_return(true)
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
it 'calls the block' do
|
|
32
32
|
block_called = false
|
|
33
33
|
schedule.schedule_next(time) { block_called = true }
|
|
34
|
-
expect(block_called).to
|
|
34
|
+
expect(block_called).to eq true
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
it 'sets the last occurrence' do
|
|
@@ -42,13 +42,13 @@ describe FistOfFury::Schedule do
|
|
|
42
42
|
|
|
43
43
|
context 'when it should not be scheduled' do
|
|
44
44
|
before :each do
|
|
45
|
-
allow(schedule).to receive(:
|
|
45
|
+
allow(schedule).to receive(:can_schedule_next?).and_return(false)
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
it 'does not call the block' do
|
|
49
49
|
block_called = false
|
|
50
50
|
schedule.schedule_next(time) { block_called = true }
|
|
51
|
-
expect(block_called).to
|
|
51
|
+
expect(block_called).to eq false
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
it 'does not set the last occurrence' do
|
|
@@ -74,14 +74,16 @@ describe FistOfFury::Schedule do
|
|
|
74
74
|
end
|
|
75
75
|
|
|
76
76
|
it 'returns the utc start time' do
|
|
77
|
-
|
|
77
|
+
now = double('now')
|
|
78
|
+
allow(now).to receive(:utc).and_return(Time.now.utc)
|
|
79
|
+
expect(Time).to receive(:now).and_return now
|
|
78
80
|
schedule
|
|
79
81
|
end
|
|
80
82
|
end
|
|
81
83
|
|
|
82
84
|
context 'when utc is not enabled' do
|
|
83
85
|
it 'returns the local start time' do
|
|
84
|
-
expect(Time).to receive(:
|
|
86
|
+
expect(Time).to receive(:now).and_return(Time.now.utc)
|
|
85
87
|
schedule
|
|
86
88
|
end
|
|
87
89
|
end
|
data/spec/fist_of_fury_spec.rb
CHANGED
|
@@ -43,7 +43,7 @@ describe FistOfFury do
|
|
|
43
43
|
allow(FistOfFury::Supervisor).to receive(:run!)
|
|
44
44
|
block_called = false
|
|
45
45
|
FistOfFury.attack! { block_called = true }
|
|
46
|
-
expect(block_called).to
|
|
46
|
+
expect(block_called).to eq true
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
it 'calls #run! on the supervisor' do
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fist_of_fury
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Joshua Rieken
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-
|
|
11
|
+
date: 2014-08-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: pry
|