knapsack_pro 3.2.0 → 3.2.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 +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/knapsack_pro/adapters/rspec_adapter.rb +12 -0
- data/lib/knapsack_pro/version.rb +1 -1
- data/spec/knapsack_pro/adapters/rspec_adapter_spec.rb +29 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d589b843abc560c3c17965cbda829fe472bb8eda866d090403c83157736b0246
|
4
|
+
data.tar.gz: 237764ce934370152bc6372f735d42f4fb0e660d0a555b99fd51842561f835e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88a10b32de62fcc1e20ac7dbb1bb46a29dfa6072c188d396e4a772171b7667d105d61742b6f6a65af32125474566cf1d0108031fbf433bef4b54145995a3d615
|
7
|
+
data.tar.gz: c3ade290ea5d7080a0fa9185ef75c5e180e85b4d9224c251198d722564330543e7c445e00eb4b2c77270345f8d2af78157565f076e25194ab22c6bc8af5fa802
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
### 3.2.1
|
4
|
+
|
5
|
+
* Raise exception when using `:focus` tag to avoid skipping RSpec tests
|
6
|
+
|
7
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/pull/167
|
8
|
+
|
9
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v3.2.0...v3.2.1
|
10
|
+
|
3
11
|
### 3.2.0
|
4
12
|
|
5
13
|
* Add an error message to `KnapsackPro::Adapters::RspecAdapter#bind`
|
@@ -62,6 +62,10 @@ module KnapsackPro
|
|
62
62
|
current_test_path
|
63
63
|
end
|
64
64
|
|
65
|
+
if example.metadata[:focus] && KnapsackPro::Adapters::RSpecAdapter.rspec_configuration.filter.rules[:focus]
|
66
|
+
raise "We detected a test file path #{current_test_path} with a test using the metadata `:focus` tag. RSpec might not run some tests in the Queue Mode (causing random tests skipping problem). Please remove the `:focus` tag from your codebase. See more: https://knapsackpro.com/faq/question/rspec-is-not-running-some-tests"
|
67
|
+
end
|
68
|
+
|
65
69
|
example.run
|
66
70
|
end
|
67
71
|
|
@@ -95,6 +99,14 @@ module KnapsackPro
|
|
95
99
|
end
|
96
100
|
end
|
97
101
|
end
|
102
|
+
|
103
|
+
private
|
104
|
+
|
105
|
+
# Hide RSpec configuration so that we could mock it in the spec.
|
106
|
+
# Mocking existing RSpec configuration could impact test's runtime.
|
107
|
+
def self.rspec_configuration
|
108
|
+
::RSpec.configuration
|
109
|
+
end
|
98
110
|
end
|
99
111
|
|
100
112
|
# This is added to provide backwards compatibility
|
data/lib/knapsack_pro/version.rb
CHANGED
@@ -175,7 +175,35 @@ describe KnapsackPro::Adapters::RSpecAdapter do
|
|
175
175
|
let(:logger) { instance_double(Logger) }
|
176
176
|
let(:global_time) { 'Global time: 01m 05s' }
|
177
177
|
let(:test_path) { 'spec/a_spec.rb' }
|
178
|
-
let(:current_example) { double }
|
178
|
+
let(:current_example) { double(metadata: {}) }
|
179
|
+
|
180
|
+
context "when the example's metadata has :focus tag AND RSpec inclusion rule includes :focus" do
|
181
|
+
let(:current_example) { double(metadata: { focus: true }) }
|
182
|
+
|
183
|
+
it do
|
184
|
+
expect(KnapsackPro::Config::Env).to receive(:rspec_split_by_test_examples?).and_return(false)
|
185
|
+
|
186
|
+
expect(config).to receive(:prepend_before).with(:context).and_yield
|
187
|
+
|
188
|
+
allow(KnapsackPro).to receive(:tracker).and_return(tracker)
|
189
|
+
expect(tracker).to receive(:start_timer).ordered
|
190
|
+
|
191
|
+
expect(config).to receive(:around).with(:each).and_yield(current_example)
|
192
|
+
expect(::RSpec).to receive(:configure).and_yield(config)
|
193
|
+
|
194
|
+
expect(tracker).to receive(:stop_timer).ordered
|
195
|
+
|
196
|
+
expect(described_class).to receive(:test_path).with(current_example).and_return(test_path)
|
197
|
+
|
198
|
+
expect(tracker).to receive(:current_test_path=).with(test_path).ordered
|
199
|
+
|
200
|
+
expect(described_class).to receive_message_chain(:rspec_configuration, :filter, :rules, :[]).with(:focus).and_return(true)
|
201
|
+
|
202
|
+
expect {
|
203
|
+
subject.bind_time_tracker
|
204
|
+
}.to raise_error /We detected a test file path spec\/a_spec\.rb with a test using the metadata `:focus` tag/
|
205
|
+
end
|
206
|
+
end
|
179
207
|
|
180
208
|
context 'when rspec split by test examples is disabled' do
|
181
209
|
before 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.2.
|
4
|
+
version: 3.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ArturT
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|