ultra_marathon 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0dc602345c49b93508d7c2b225dc5e18a93646dc
4
- data.tar.gz: 0f05f99e159f6f9fb10541c83d91ac82aa7cda9d
3
+ metadata.gz: fb3d6475f8059ad245b2903fe1cd351094518d22
4
+ data.tar.gz: e691570e98c3c6988dda441d86812e745bca1991
5
5
  SHA512:
6
- metadata.gz: a38d2315e48905e5c10fe4b5ff91cd3e9e2b947a1b5187d93e9e5f17d3c31f5c00a7ce70555297ffcc48bc021d877d8469efcc88bdaf474bcc55a676174078fc
7
- data.tar.gz: dcecb158baddd172cabe0c4a2c2320dbc94d94ded033055befe868f5d74c32756be5588819f90593cd13c958bedbd09f0a141c8a46ac5352cb361b2a1e9006b3
6
+ metadata.gz: 37279e51d6363da7efe03738001fd322e2ad09fa7d4223ac6326556860ab68d3f30e62a593b55ccf87c16af988b40427d6a31669d36e2265cdbabbc291dda600
7
+ data.tar.gz: 8a19cdd425fa40c3a579e9bae177d2700728a3a3a3a7ee3837b0fab4cf149de893fb2048c8a0c9f8663b5aa6aeb08c9c9b19dc2f872131ea90a43732e956831b
@@ -25,7 +25,7 @@ module UltraMarathon
25
25
  def initialize(options, run_block)
26
26
  @name = options[:name]
27
27
  @options = {
28
- instrument: true
28
+ instrument: false
29
29
  }.merge(options)
30
30
  @sub_context = SubContext.new(options[:context], run_block)
31
31
  end
@@ -48,6 +48,8 @@ module UltraMarathon
48
48
  if options[:instrument]
49
49
  run_profile = instrumentations[:run]
50
50
  logger.info """
51
+ End Time: #{run_profile.formatted_end_time}
52
+ Start Time: #{run_profile.formatted_start_time}
51
53
  Total Time: #{run_profile.formatted_total_time}
52
54
  """
53
55
  end
@@ -69,7 +71,6 @@ module UltraMarathon
69
71
  def run_sub_context
70
72
  invoke_before_run_callbacks
71
73
  sub_context.call
72
- invoke_after_run_callbacks
73
74
  end
74
75
 
75
76
  def log_header_and_sub_context
@@ -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 = 2 unless defined? PATCH
5
+ PATCH = 3 unless defined? PATCH
6
6
  PRE = nil unless defined? PRE
7
7
 
8
8
  class << self
@@ -52,6 +52,10 @@ describe UltraMarathon::SubRunner do
52
52
  end
53
53
 
54
54
  describe 'instrumentation' do
55
+ let(:options) do
56
+ { context: context, name: name, instrument: true }
57
+ end
58
+
55
59
  it 'should log the total time' do
56
60
  subject
57
61
  test_instance.logger.contents.should include 'Total Time:'
@@ -67,5 +71,26 @@ describe UltraMarathon::SubRunner do
67
71
  end
68
72
  end
69
73
  end
74
+
75
+ describe 'callbacks' do
76
+ it 'should invoke before_run callbacks once' do
77
+ expect(test_instance).to receive(:invoke_before_run_callbacks).once
78
+ subject
79
+ end
80
+
81
+ it 'should invoke after_run callbacks once' do
82
+ expect(test_instance).to receive(:invoke_after_run_callbacks).once
83
+ subject
84
+ end
85
+
86
+ it 'should invoke before_run callbacks, the subcontext, then after_run callbacks' do
87
+ sub_context = double(:sub_context)
88
+ test_instance.stub(:sub_context) { sub_context }
89
+ expect(test_instance).to receive(:invoke_before_run_callbacks).ordered
90
+ expect(sub_context).to receive(:call).ordered
91
+ expect(test_instance).to receive(:invoke_after_run_callbacks).ordered
92
+ subject
93
+ end
94
+ end
70
95
  end
71
96
  end
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.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Maddox