ultra_marathon 0.1.5 → 0.1.7
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: c7d97a30d4a344932ef8d315457e5072ec08da58
|
4
|
+
data.tar.gz: 1aaf3b10556ce6344fe795438a1d176254b43a77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb05ac7278f5cb8d6537650dde46c3fb8377d8460afe832e243b87079162e0c20ec9065903257aaf3e34666378099ee6ebc8c871a29ec2b99e675bb3fa39fd11
|
7
|
+
data.tar.gz: 32a14722374518f955594603987ebde23ed1443ee8579164c7021b18e611b032a1f038f200e9a5be1ce068149d4b70613824d898d5f52a370ef4140c4275512f
|
@@ -22,10 +22,11 @@ module UltraMarathon
|
|
22
22
|
def run!
|
23
23
|
if self.class.run_blocks.any?
|
24
24
|
begin
|
25
|
-
self.success =
|
25
|
+
self.success = nil
|
26
26
|
invoke_before_run_callbacks
|
27
27
|
instrument(:run_unrun_sub_runners) { run_unrun_sub_runners }
|
28
|
-
|
28
|
+
# If any of the sub runners explicitly set the success flag, don't override it
|
29
|
+
self.success = failed_sub_runners.empty? if self.success.nil?
|
29
30
|
rescue StandardError => error
|
30
31
|
invoke_on_error_callbacks(error)
|
31
32
|
ensure
|
@@ -43,7 +44,7 @@ module UltraMarathon
|
|
43
44
|
# sets the unrun sub_runners to be the uncompleted/failed ones
|
44
45
|
def reset
|
45
46
|
reset_failed_runners
|
46
|
-
@success =
|
47
|
+
@success = nil
|
47
48
|
invoke_on_reset_callbacks
|
48
49
|
self
|
49
50
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module UltraMarathon
|
2
2
|
module Instrumentation
|
3
3
|
class Profile
|
4
|
-
attr_reader :name, :
|
4
|
+
attr_reader :name, :start_time, :end_time
|
5
5
|
|
6
6
|
## Public Instance Methods
|
7
7
|
|
@@ -9,7 +9,7 @@ module UltraMarathon
|
|
9
9
|
@name = name
|
10
10
|
# Ruby cannot marshal procs or lambdas, so we need to define a method.
|
11
11
|
# Binding to self allows us to intercept logging calls.
|
12
|
-
define_singleton_method :
|
12
|
+
define_singleton_method :instrumented_block do
|
13
13
|
block.call
|
14
14
|
end
|
15
15
|
end
|
@@ -17,7 +17,7 @@ module UltraMarathon
|
|
17
17
|
def call
|
18
18
|
@start_time = Time.now
|
19
19
|
begin
|
20
|
-
return_value =
|
20
|
+
return_value = instrumented_block
|
21
21
|
ensure
|
22
22
|
@end_time = Time.now
|
23
23
|
end
|
@@ -41,6 +41,15 @@ describe UltraMarathon::AbstractRunner do
|
|
41
41
|
test_instance.success.should_not be
|
42
42
|
end
|
43
43
|
end
|
44
|
+
|
45
|
+
context 'when the run block explicitly sets success' do
|
46
|
+
let(:run_block) { Proc.new { self.success = false } }
|
47
|
+
|
48
|
+
it 'should not override it' do
|
49
|
+
subject
|
50
|
+
test_instance.success.should_not be
|
51
|
+
end
|
52
|
+
end
|
44
53
|
end
|
45
54
|
|
46
55
|
describe 'with multiple run blocks' do
|
@@ -148,10 +157,10 @@ describe UltraMarathon::AbstractRunner do
|
|
148
157
|
end
|
149
158
|
|
150
159
|
describe '#reset' do
|
151
|
-
it 'should change success to
|
160
|
+
it 'should change success to nil' do
|
152
161
|
test_instance.success = false
|
153
162
|
test_instance.reset
|
154
|
-
test_instance.success.should
|
163
|
+
test_instance.success.should be_nil
|
155
164
|
end
|
156
165
|
|
157
166
|
it 'returns itself' do
|