knapsack_pro 3.2.0 → 3.2.1

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: 5baae9cb1ea264d73e085e9f475b4f775e06801992ffd715f33a90fc93fd974f
4
- data.tar.gz: e74b748147d57817546675c86ea534274f65cf287e52884d3960f09aa44efbb7
3
+ metadata.gz: d589b843abc560c3c17965cbda829fe472bb8eda866d090403c83157736b0246
4
+ data.tar.gz: 237764ce934370152bc6372f735d42f4fb0e660d0a555b99fd51842561f835e8
5
5
  SHA512:
6
- metadata.gz: 8f6102eef985cb8cb6c810053be5afecefcf309eb6a8367e3bcacdde09fb6bd10aa8d6ea10f68cdcdaf9b02a83117f2720ba6613562183c1ec9d52751ca87d56
7
- data.tar.gz: b8c3d75e4267141135723fd29de4d5b97dffc1485dc762d7a9df0ba449c0827fa184261ffc101435b94678a7fc89bc8ed75876937a96d90ee6fd6103d7e38362
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
@@ -1,3 +1,3 @@
1
1
  module KnapsackPro
2
- VERSION = '3.2.0'
2
+ VERSION = '3.2.1'
3
3
  end
@@ -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.0
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-03 00:00:00.000000000 Z
11
+ date: 2022-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake