knapsack 1.21.0 → 1.21.1

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
  SHA256:
3
- metadata.gz: 620ac5f634996f21d32b1c65ac8609a61c47ac6f07b773fe1fa2bf6487f41d88
4
- data.tar.gz: e5851433f161642429b11bea40e28ad37a0bd5f7008f34b641750afc7168e8e5
3
+ metadata.gz: 3e6b6142c645cc42ac120b5872e16ac97f6d82f5f4cb0ff2993039ec754855b6
4
+ data.tar.gz: 82ce25f5e1982e4eb8d454e2e61246471e8e67427071383f360cf5a76025bcbc
5
5
  SHA512:
6
- metadata.gz: edf2dbf2877aa04107e8a62e6ea91426df85288a87954d28068d3bb49dc31006bf61094bff3b564eb7d9b302b5966d2656e418bd83cd5a7ab751f9e2d33763b5
7
- data.tar.gz: 14d9e941b65ffad0d5ec9d5120d56a77be8dc30ba4e2bb463a8621fe04947c804e1db41e7b10ae5a9ff87439acda309e1accb0076683e62ab1e25ca86f33718d
6
+ metadata.gz: c95d0502a2d00acb89cf8170b726d42d7b11b2a1f1c7169ab5c1a30f17145330223aebb1ba4abe8af168bbba43ee2209a24d133728b225d790b89fd6079fd4d4
7
+ data.tar.gz: ea2f59c4f71f9bce115b13648e0d281c9cfba683ab676bbc1aa9973b154d85bc3e99d2871f15420f8822be306e7969159316d8765334348337bcb156c8532409
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  * TODO
4
4
 
5
+ ### 1.21.1
6
+
7
+ * Fix a bug with tracking time for pending specs in RSpec
8
+
9
+ https://github.com/KnapsackPro/knapsack/pull/109
10
+
11
+ https://github.com/KnapsackPro/knapsack/compare/v1.21.0...v1.21.1
12
+
5
13
  ### 1.21.0
6
14
 
7
15
  * Track time in before and after `:context` hooks
@@ -23,15 +23,19 @@ module Knapsack
23
23
  end
24
24
 
25
25
  def stop_timer
26
- @execution_time = now_without_mock_time.to_f - @start_time
27
- update_global_time
28
- update_test_file_time
29
- @execution_time
26
+ execution_time = now_without_mock_time.to_f - @start_time
27
+
28
+ if test_path
29
+ update_global_time(execution_time)
30
+ update_test_file_time(execution_time)
31
+ @test_path = nil
32
+ end
33
+
34
+ execution_time
30
35
  end
31
36
 
32
37
  def test_path
33
- raise("test_path needs to be set by Knapsack Adapter's bind method") unless @test_path
34
- @test_path.sub(/^\.\//, '')
38
+ @test_path.sub(/^\.\//, '') if @test_path
35
39
  end
36
40
 
37
41
  def time_exceeded?
@@ -62,13 +66,13 @@ module Knapsack
62
66
  @test_path = nil
63
67
  end
64
68
 
65
- def update_global_time
66
- @global_time += @execution_time
69
+ def update_global_time(execution_time)
70
+ @global_time += execution_time
67
71
  end
68
72
 
69
- def update_test_file_time
73
+ def update_test_file_time(execution_time)
70
74
  @test_files_with_time[test_path] ||= 0
71
- @test_files_with_time[test_path] += @execution_time
75
+ @test_files_with_time[test_path] += execution_time
72
76
  end
73
77
 
74
78
  def report_distributor
@@ -1,3 +1,3 @@
1
1
  module Knapsack
2
- VERSION = '1.21.0'
2
+ VERSION = '1.21.1'
3
3
  end
@@ -48,7 +48,7 @@ describe Knapsack::Tracker do
48
48
 
49
49
  context 'when test_path not set' do
50
50
  it do
51
- expect { subject }.to raise_error("test_path needs to be set by Knapsack Adapter's bind method")
51
+ expect(subject).to be_nil
52
52
  end
53
53
  end
54
54
 
@@ -133,6 +133,9 @@ describe Knapsack::Tracker do
133
133
  it { expect(tracker.test_files_with_time.keys.size).to eql 2 }
134
134
  it { expect(tracker.test_files_with_time['a_spec.rb']).to be_within(delta).of(0.1) }
135
135
  it { expect(tracker.test_files_with_time['b_spec.rb']).to be_within(delta).of(0.2) }
136
+ it 'resets test_path after time is measured' do
137
+ expect(tracker.test_path).to be_nil
138
+ end
136
139
  end
137
140
 
138
141
  context "with Timecop - Timecop shouldn't have impact on measured test time" do
@@ -157,6 +160,9 @@ describe Knapsack::Tracker do
157
160
  it { expect(tracker.test_files_with_time.keys.size).to eql 2 }
158
161
  it { expect(tracker.test_files_with_time['a_spec.rb']).to be_within(delta).of(0) }
159
162
  it { expect(tracker.test_files_with_time['b_spec.rb']).to be_within(delta).of(0) }
163
+ it 'resets test_path after time is measured' do
164
+ expect(tracker.test_path).to be_nil
165
+ end
160
166
  end
161
167
  end
162
168
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knapsack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.21.0
4
+ version: 1.21.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT