knapsack 1.21.0 → 1.21.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/knapsack/tracker.rb +14 -10
- data/lib/knapsack/version.rb +1 -1
- data/spec/knapsack/tracker_spec.rb +7 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e6b6142c645cc42ac120b5872e16ac97f6d82f5f4cb0ff2993039ec754855b6
|
4
|
+
data.tar.gz: 82ce25f5e1982e4eb8d454e2e61246471e8e67427071383f360cf5a76025bcbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/knapsack/tracker.rb
CHANGED
@@ -23,15 +23,19 @@ module Knapsack
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def stop_timer
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
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
|
-
|
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 +=
|
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] +=
|
75
|
+
@test_files_with_time[test_path] += execution_time
|
72
76
|
end
|
73
77
|
|
74
78
|
def report_distributor
|
data/lib/knapsack/version.rb
CHANGED
@@ -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
|
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
|
|