knapsack_pro 3.6.0 → 3.7.0

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
  SHA256:
3
- metadata.gz: ba65a6353675fce4c06920c5dca6b7dcc90aee4a978db714f28bf9305f5208e3
4
- data.tar.gz: 345aa8cf66464faeeb05cc3adcd2fcf904862aa02ea3f6a0109ca83f37c7c332
3
+ metadata.gz: 98e74bc85a91b0e94977b272f81e7efcd85a3ca242b4c7afc3d61340e56b02e4
4
+ data.tar.gz: 8732eb25ee525d4d3d73a7dc0c23ed92ebe3597bf4a24946a8ae7a291a7746ee
5
5
  SHA512:
6
- metadata.gz: c12d293d3ac2ca00f33e5802f4c6cf0c8f9ef08dd76d5217892efcb14a8bc090b6f5a118514c79a7066baf8449c3b2406e7b6d4a867b4b479a9bda841d057dbf
7
- data.tar.gz: 757a63fd917a7fc685659fe6d64d01b19800fa3cc81b4f66d7e9fd08ed9631b28c727544577bae13faae3e54c3b1b3fb3624b2d69e6b74287887c3cb1fb95c44
6
+ metadata.gz: 87f2bbebde7460541fa539fea85fa195b52e1e84cd4a40e296287ba6e35dd682ab7676b28822911483e2aee1ff711421995c3b75a7cd31b2a095e7c76971acdc
7
+ data.tar.gz: d4ed38d722c0b7a3bdad17bb292c20a5040f583ad3b3aa45371e364a0d9d0bac6168d1d37350a224d4494ff88cb2db1c641d2e45b88fe812eed2c5c3f37d2d50
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Change Log
2
2
 
3
+ ### 3.7.0
4
+
5
+ * Adjust the timer behaviour in the RSpec adapter
6
+
7
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/184
8
+
9
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v3.6.0...v3.7.0
10
+
3
11
  ### 3.6.0
4
12
 
5
13
  * Add an attempt to read from the cache for Regular Mode API
@@ -48,12 +48,16 @@ module KnapsackPro
48
48
  end
49
49
 
50
50
  config.around(:each) do |example|
51
- # stop timer to update time for a previously run test example
52
- # this way we count time spend in runtime for the previous test example after around(:each) is already done
53
- KnapsackPro.tracker.stop_timer
54
-
55
51
  current_test_path = KnapsackPro::Adapters::RSpecAdapter.test_path(example)
56
52
 
53
+ # Stop timer to update time for a previously run test example.
54
+ # This way we count time spent in runtime for the previous test example after around(:each) is already done.
55
+ # Only do that if we're in the same test file. Otherwise, `before(:all)` execution time in the current file
56
+ # will be applied to the previously ran test file.
57
+ if KnapsackPro.tracker.current_test_path&.start_with?(KnapsackPro::TestFileCleaner.clean(current_test_path))
58
+ KnapsackPro.tracker.stop_timer
59
+ end
60
+
57
61
  KnapsackPro.tracker.current_test_path =
58
62
  if KnapsackPro::Config::Env.rspec_split_by_test_examples? && KnapsackPro::Adapters::RSpecAdapter.slow_test_file?(RSpecAdapter, current_test_path)
59
63
  example.id
@@ -46,7 +46,8 @@ module KnapsackPro
46
46
  end
47
47
 
48
48
  def current_test_path
49
- raise("current_test_path needs to be set by Knapsack Pro Adapter's bind method") unless @current_test_path
49
+ return unless @current_test_path
50
+
50
51
  KnapsackPro::TestFileCleaner.clean(@current_test_path)
51
52
  end
52
53
 
@@ -1,3 +1,3 @@
1
1
  module KnapsackPro
2
- VERSION = '3.6.0'
2
+ VERSION = '3.7.0'
3
3
  end
@@ -243,6 +243,7 @@ describe KnapsackPro::Adapters::RSpecAdapter do
243
243
  expect(config).to receive(:around).with(:each).and_yield(current_example)
244
244
  expect(::RSpec).to receive(:configure).and_yield(config)
245
245
 
246
+ expect(tracker).to receive(:current_test_path).ordered.and_return(test_path)
246
247
  expect(tracker).to receive(:stop_timer).ordered
247
248
 
248
249
  expect(described_class).to receive(:test_path).with(current_example).and_return(test_path)
@@ -273,6 +274,7 @@ describe KnapsackPro::Adapters::RSpecAdapter do
273
274
  expect(config).to receive(:after).with(:suite).and_yield
274
275
  expect(::RSpec).to receive(:configure).and_yield(config)
275
276
 
277
+ expect(tracker).to receive(:current_test_path).ordered.and_return(test_path)
276
278
  expect(tracker).to receive(:stop_timer).ordered
277
279
 
278
280
  expect(described_class).to receive(:test_path).with(current_example).and_return(test_path)
@@ -316,6 +318,7 @@ describe KnapsackPro::Adapters::RSpecAdapter do
316
318
  expect(config).to receive(:after).with(:suite).and_yield
317
319
  expect(::RSpec).to receive(:configure).and_yield(config)
318
320
 
321
+ expect(tracker).to receive(:current_test_path).ordered.and_return(test_path)
319
322
  expect(tracker).to receive(:stop_timer).ordered
320
323
 
321
324
  expect(described_class).to receive(:test_path).with(current_example).and_return(test_path)
@@ -352,6 +355,7 @@ describe KnapsackPro::Adapters::RSpecAdapter do
352
355
 
353
356
  expect(described_class).to receive(:test_path).with(current_example).and_return(test_path)
354
357
 
358
+ expect(tracker).to receive(:current_test_path).ordered.and_return(test_path)
355
359
  expect(tracker).to receive(:stop_timer).ordered
356
360
 
357
361
  expect(tracker).to receive(:current_test_path=).with(test_path).ordered
@@ -19,9 +19,7 @@ describe KnapsackPro::Tracker do
19
19
  subject { tracker.current_test_path }
20
20
 
21
21
  context 'when current_test_path not set' do
22
- it do
23
- expect { subject }.to raise_error("current_test_path needs to be set by Knapsack Pro Adapter's bind method")
24
- end
22
+ it { should eql nil }
25
23
  end
26
24
 
27
25
  context 'when current_test_path set' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knapsack_pro
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.0
4
+ version: 3.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-09 00:00:00.000000000 Z
11
+ date: 2022-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -390,7 +390,7 @@ metadata:
390
390
  documentation_uri: https://docs.knapsackpro.com/integration/
391
391
  homepage_uri: https://knapsackpro.com
392
392
  source_code_uri: https://github.com/KnapsackPro/knapsack_pro-ruby
393
- post_install_message:
393
+ post_install_message:
394
394
  rdoc_options: []
395
395
  require_paths:
396
396
  - lib
@@ -405,8 +405,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
405
405
  - !ruby/object:Gem::Version
406
406
  version: '0'
407
407
  requirements: []
408
- rubygems_version: 3.3.7
409
- signing_key:
408
+ rubygems_version: 3.1.6
409
+ signing_key:
410
410
  specification_version: 4
411
411
  summary: Knapsack Pro splits tests across parallel CI nodes and ensures each parallel
412
412
  job finish work at a similar time.