knapsack 3.1.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/knapsack.gemspec +1 -1
- data/lib/knapsack/adapters/rspec_adapter.rb +6 -10
- data/lib/knapsack/version.rb +1 -1
- data/spec/knapsack/adapters/rspec_adapter_spec.rb +12 -13
- metadata +3 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22056a9ce80fe227bf9a1a03c5dd700f6cf3445d5fc69203a42a0756f98c5ccf
|
4
|
+
data.tar.gz: 44bba135b5624b37c8f800b65c206a0552406c9a10499fdefb8d22e7cbfccfaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c07fbfb345373b82a0ad29aa5854d12285946725ceefb3dae95a67f53479af781beb1f90caea035ec66d6808c0f408c8f35df592f971f4a05f46545f10ed1d98
|
7
|
+
data.tar.gz: 197a4ba91a928c7202ab19105a1f8e65556d441a655532ccae96854de468a6de2eba8dfd7867aa4364d5b5a898f1a307cd4f53938e69bdbba39ac48022156bc2
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,15 @@
|
|
2
2
|
|
3
3
|
* TODO
|
4
4
|
|
5
|
+
### 4.0.0
|
6
|
+
|
7
|
+
* __(breaking change)__ Remove support for RSpec 2.x. This change was already done by accident in [the pull request](https://github.com/KnapsackPro/knapsack/pull/107) when we added the RSpec `context` hook, which is available only since RSpec 3.x.
|
8
|
+
* Use RSpec `example` block argument instead of the global `RSpec.current_example`. This allows to run tests with the `async-rspec` gem.
|
9
|
+
|
10
|
+
https://github.com/KnapsackPro/knapsack/pull/117
|
11
|
+
|
12
|
+
https://github.com/KnapsackPro/knapsack/compare/v3.1.0...v4.0.0
|
13
|
+
|
5
14
|
### 3.1.0
|
6
15
|
|
7
16
|
* Sorting Algorithm: round robin to least connections
|
data/knapsack.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_dependency 'rake', '>= 0'
|
24
24
|
|
25
25
|
spec.add_development_dependency 'bundler', '>= 1.6'
|
26
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
26
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
27
27
|
spec.add_development_dependency 'rspec-its', '~> 1.3'
|
28
28
|
spec.add_development_dependency 'cucumber', '>= 0'
|
29
29
|
spec.add_development_dependency 'spinach', '>= 0.8'
|
@@ -10,14 +10,8 @@ module Knapsack
|
|
10
10
|
Knapsack.tracker.start_timer
|
11
11
|
end
|
12
12
|
|
13
|
-
config.prepend_before(:each) do
|
14
|
-
|
15
|
-
if ::RSpec.respond_to?(:current_example)
|
16
|
-
::RSpec.current_example.metadata[:example_group]
|
17
|
-
else
|
18
|
-
example.metadata
|
19
|
-
end
|
20
|
-
Knapsack.tracker.test_path = RSpecAdapter.test_path(current_example_group)
|
13
|
+
config.prepend_before(:each) do |example|
|
14
|
+
Knapsack.tracker.test_path = RSpecAdapter.test_path(example)
|
21
15
|
end
|
22
16
|
|
23
17
|
config.append_after(:context) do
|
@@ -50,8 +44,10 @@ module Knapsack
|
|
50
44
|
end
|
51
45
|
end
|
52
46
|
|
53
|
-
def self.test_path(
|
54
|
-
|
47
|
+
def self.test_path(example)
|
48
|
+
example_group = example.metadata[:example_group]
|
49
|
+
|
50
|
+
if defined?(::Turnip) && Gem::Version.new(::Turnip::VERSION) < Gem::Version.new('2.0.0')
|
55
51
|
unless example_group[:turnip]
|
56
52
|
until example_group[:parent_example_group].nil?
|
57
53
|
example_group = example_group[:parent_example_group]
|
data/lib/knapsack/version.rb
CHANGED
@@ -16,22 +16,16 @@ describe Knapsack::Adapters::RSpecAdapter do
|
|
16
16
|
let(:tracker) { instance_double(Knapsack::Tracker) }
|
17
17
|
let(:test_path) { 'spec/a_spec.rb' }
|
18
18
|
let(:global_time) { 'Global time: 01m 05s' }
|
19
|
-
let(:
|
20
|
-
let(:current_example) do
|
21
|
-
OpenStruct.new(metadata: {
|
22
|
-
example_group: example_group
|
23
|
-
})
|
24
|
-
end
|
19
|
+
let(:current_example) { double }
|
25
20
|
|
26
21
|
it do
|
27
22
|
expect(config).to receive(:prepend_before).with(:context).and_yield
|
28
|
-
expect(config).to receive(:prepend_before).with(:each).and_yield
|
23
|
+
expect(config).to receive(:prepend_before).with(:each).and_yield(current_example)
|
29
24
|
expect(config).to receive(:append_after).with(:context).and_yield
|
30
25
|
expect(config).to receive(:after).with(:suite).and_yield
|
31
26
|
expect(::RSpec).to receive(:configure).and_yield(config)
|
32
27
|
|
33
|
-
expect(
|
34
|
-
expect(described_class).to receive(:test_path).with(example_group).and_return(test_path)
|
28
|
+
expect(described_class).to receive(:test_path).with(current_example).and_return(test_path)
|
35
29
|
|
36
30
|
allow(Knapsack).to receive(:tracker).and_return(tracker)
|
37
31
|
expect(tracker).to receive(:start_timer).ordered
|
@@ -81,7 +75,7 @@ describe Knapsack::Adapters::RSpecAdapter do
|
|
81
75
|
end
|
82
76
|
|
83
77
|
describe '.test_path' do
|
84
|
-
let(:
|
78
|
+
let(:example_group) do
|
85
79
|
{
|
86
80
|
file_path: '1_shared_example.rb',
|
87
81
|
parent_example_group: {
|
@@ -92,14 +86,19 @@ describe Knapsack::Adapters::RSpecAdapter do
|
|
92
86
|
}
|
93
87
|
}
|
94
88
|
end
|
89
|
+
let(:current_example) do
|
90
|
+
OpenStruct.new(metadata: {
|
91
|
+
example_group: example_group
|
92
|
+
})
|
93
|
+
end
|
95
94
|
|
96
|
-
subject { described_class.test_path(
|
95
|
+
subject { described_class.test_path(current_example) }
|
97
96
|
|
98
97
|
it { should eql 'a_spec.rb' }
|
99
98
|
|
100
99
|
context 'with turnip features' do
|
101
100
|
describe 'when the turnip version is less than 2' do
|
102
|
-
let(:
|
101
|
+
let(:example_group) do
|
103
102
|
{
|
104
103
|
file_path: "./spec/features/logging_in.feature",
|
105
104
|
turnip: true,
|
@@ -115,7 +114,7 @@ describe Knapsack::Adapters::RSpecAdapter do
|
|
115
114
|
end
|
116
115
|
|
117
116
|
describe 'when turnip is version 2 or greater' do
|
118
|
-
let(:
|
117
|
+
let(:example_group) do
|
119
118
|
{
|
120
119
|
file_path: "gems/turnip-2.0.0/lib/turnip/rspec.rb",
|
121
120
|
turnip: true,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knapsack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ArturT
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -45,9 +45,6 @@ dependencies:
|
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '3.0'
|
48
|
-
- - ">="
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version: 2.10.0
|
51
48
|
type: :development
|
52
49
|
prerelease: false
|
53
50
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -55,9 +52,6 @@ dependencies:
|
|
55
52
|
- - "~>"
|
56
53
|
- !ruby/object:Gem::Version
|
57
54
|
version: '3.0'
|
58
|
-
- - ">="
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: 2.10.0
|
61
55
|
- !ruby/object:Gem::Dependency
|
62
56
|
name: rspec-its
|
63
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -269,7 +263,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
269
263
|
- !ruby/object:Gem::Version
|
270
264
|
version: '0'
|
271
265
|
requirements: []
|
272
|
-
rubygems_version: 3.2.
|
266
|
+
rubygems_version: 3.2.22
|
273
267
|
signing_key:
|
274
268
|
specification_version: 4
|
275
269
|
summary: Knapsack splits tests across CI nodes and makes sure that tests will run
|