selective-ruby-rspec 0.1.11 → 0.1.13

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 426ab12601e0822a115da8675d7b44e5f9077bdda5d05ec46fdfcb0c9356d803
4
- data.tar.gz: 53fe3435e2f29a0889b9d3b2a518ea43b43a7c239d8b9c116bf924dfed374d69
3
+ metadata.gz: 238f5bcf12278f31375b5ec8aa214b5c481f51950e937150456282e32403da2c
4
+ data.tar.gz: ed0b17ea2bd15e77415452f35ba220bb300ab4ef415fce39ae13e0eaaa125b04
5
5
  SHA512:
6
- metadata.gz: d75efe63bc4f3e2796a1373f3b579e81b6365e04400e251b4ba2d3fdc90bd2f77dccb9e929d8ad43a77af69946dc998778f195ddf41365f4142972d2c4cbf8b9
7
- data.tar.gz: b779506abdfa447f714d204ed9e1c44281cadffd63a92fc65df94a876e94573b1e61265d0adfd5af71fce8eb93ad4eb74158f044706ba5d682f526dbb4f926a3
6
+ metadata.gz: 283f02c6092c1f098e6e773a48ac4a3d5b96ad435e229e02d571e87d8c85ef24ce4f68e097ac1f0cff18fd23e03ded321907ad87f17c3cdaf0a6a2a5052b417b
7
+ data.tar.gz: c1d52ca30661f273f15201bb33a2f038d231ed5e16e6e80661d948a73f6b781332c8c81289d769eada9fc2e164f6665e6e347af1356b379e43bab2fb16aedee8
@@ -217,7 +217,7 @@ module Selective
217
217
  # is included.
218
218
  if config[:require_each_hooks]
219
219
  ::RSpec::Core::ExampleGroup.extend(RequireEachHooks)
220
- else
220
+ elsif !config[:preserve_all_hooks]
221
221
  ::RSpec::Core::ExampleGroup.extend(Hooks)
222
222
  end
223
223
 
@@ -49,7 +49,9 @@ module Selective
49
49
  def run_test_cases(test_case_ids)
50
50
  ensure_test_phase
51
51
  configure(test_case_ids)
52
- rspec_runner.run_specs(optimize_test_filtering(test_case_ids).to_a)
52
+ groups = optimize_test_filtering(test_case_ids).to_a
53
+ reset_group_memoization(groups)
54
+ rspec_runner.run_specs(groups)
53
55
  if connection_lost
54
56
  self.connection_lost = false
55
57
  raise Selective::Ruby::Core::ConnectionLostError
@@ -108,7 +110,7 @@ module Selective
108
110
  private
109
111
 
110
112
  def parse_args(args)
111
- supported_wrapper_args = %w[--require-each-hooks]
113
+ supported_wrapper_args = %w[--require-each-hooks --preserve-all-hooks]
112
114
  wrapper_args, rspec_args = args.partition do |arg|
113
115
  supported_wrapper_args.any? do |p|
114
116
  arg.start_with?(p)
@@ -147,14 +149,25 @@ module Selective
147
149
 
148
150
  def failure_formatter(example)
149
151
  presenter = ::RSpec::Core::Formatters::ExceptionPresenter::Factory.new(example).build
152
+ message_lines = presenter.message_lines
153
+ message_lines = multiple_exception_lines(presenter) if message_lines.empty?
150
154
 
151
155
  {
152
- failure_message_lines: presenter.message_lines,
156
+ failure_message_lines: message_lines,
153
157
  failure_formatted_backtrace: presenter.formatted_backtrace
154
158
  # failure_full_backtrace: example.exception.backtrace
155
159
  }
156
160
  end
157
161
 
162
+ # RSpec keeps the detail of a MultipleExceptionError (aggregate_failures,
163
+ # or an example and a hook both failing) only in its fully formatted output.
164
+ def multiple_exception_lines(presenter)
165
+ lines = presenter.fully_formatted_lines(nil, ::RSpec::Core::Notifications::NullColorizer).map(&:to_s)
166
+ lines = lines.drop_while { |line| line.strip.empty? }
167
+ lines = lines.drop(1) if presenter.description && lines.first&.strip == presenter.description.to_s.strip
168
+ lines.map { |line| line.sub(/\A /, "") }
169
+ end
170
+
158
171
  def apply_rspec_configuration
159
172
  ::RSpec.configure do |config|
160
173
  config.backtrace_exclusion_patterns = config.backtrace_exclusion_patterns | [/lib\/selective/]
@@ -190,6 +203,13 @@ module Selective
190
203
  end
191
204
  end
192
205
 
206
+ # RSpec memoizes descendant_filtered_examples per group and decides from it
207
+ # whether to run before(:all)/after(:all); a stale value from an earlier
208
+ # batch skips a group's context hooks.
209
+ def reset_group_memoization(top_level_groups)
210
+ top_level_groups.each { |group| group.descendants.each(&:reset_memoized) }
211
+ end
212
+
193
213
  def ensure_test_phase
194
214
  @test_phase_initialized ||= begin
195
215
  ::RSpec.world.reporter.send(:start, nil)
@@ -3,7 +3,7 @@
3
3
  module Selective
4
4
  module Ruby
5
5
  module RSpec
6
- VERSION = "0.1.11"
6
+ VERSION = "0.1.13"
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selective-ruby-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Wood
@@ -9,22 +9,28 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2026-10-08 00:00:00.000000000 Z
12
+ date: 2026-11-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: zeitwerk
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: 2.6.12
21
+ - - "<"
22
+ - !ruby/object:Gem::Version
23
+ version: '3'
21
24
  type: :runtime
22
25
  prerelease: false
23
26
  version_requirements: !ruby/object:Gem::Requirement
24
27
  requirements:
25
- - - "~>"
28
+ - - ">="
26
29
  - !ruby/object:Gem::Version
27
30
  version: 2.6.12
31
+ - - "<"
32
+ - !ruby/object:Gem::Version
33
+ version: '3'
28
34
  - !ruby/object:Gem::Dependency
29
35
  name: selective-ruby-core
30
36
  requirement: !ruby/object:Gem::Requirement
@@ -95,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
101
  - !ruby/object:Gem::Version
96
102
  version: '0'
97
103
  requirements: []
98
- rubygems_version: 3.4.10
104
+ rubygems_version: 3.5.22
99
105
  signing_key:
100
106
  specification_version: 4
101
107
  summary: Selective Ruby RSpec Client