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: 78af7958fcfe70a891487fcd799959195c4b2499
4
- data.tar.gz: dac02b061c91219cda0fbd62dfd95bcb47be2590
3
+ metadata.gz: c7d97a30d4a344932ef8d315457e5072ec08da58
4
+ data.tar.gz: 1aaf3b10556ce6344fe795438a1d176254b43a77
5
5
  SHA512:
6
- metadata.gz: a876d0f4901169613407e0d9d7de5522a64cd4acb5b500b36a7513e68cf8e1f7951e08c529996bdb0a6371625c6965dc1b08c69a404f81b7768c9d5861a5393f
7
- data.tar.gz: 8a21f8f77b94922fe2be0e6fd334708d8e6bcabba890bb28924e9d98d9d860564681cac2529272bf4777f6c05f798eb552986870964cc2c50cc0708cc8e2cdfe
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 = true
25
+ self.success = nil
26
26
  invoke_before_run_callbacks
27
27
  instrument(:run_unrun_sub_runners) { run_unrun_sub_runners }
28
- self.success = failed_sub_runners.empty?
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 = true
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, :instrument_block, :start_time, :end_time
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 :instrumentated_block do
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 = instrumentated_block
20
+ return_value = instrumented_block
21
21
  ensure
22
22
  @end_time = Time.now
23
23
  end
@@ -2,7 +2,7 @@ module UltraMarathon
2
2
  class Version
3
3
  MAJOR = 0 unless defined? MAJOR
4
4
  MINOR = 1 unless defined? MINOR
5
- PATCH = 5 unless defined? PATCH
5
+ PATCH = 7 unless defined? PATCH
6
6
  PRE = nil unless defined? PRE
7
7
 
8
8
  class << self
@@ -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 true' do
160
+ it 'should change success to nil' do
152
161
  test_instance.success = false
153
162
  test_instance.reset
154
- test_instance.success.should be
163
+ test_instance.success.should be_nil
155
164
  end
156
165
 
157
166
  it 'returns itself' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ultra_marathon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Maddox