rspec_trunk_flaky_tests 0.16.1.pre.beta.1-aarch64-linux-gnu → 0.16.2.pre.beta.3-aarch64-linux-gnu

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: c908033e645bb9359d694008af63e683defe687b2e98db9085089579368f8136
4
- data.tar.gz: 0b1fcd78b0f285a8b70c0ffb873d961fb5ad10a716242aaf25ab16b4a25c257d
3
+ metadata.gz: 3a547c0fe5f732720a1c612c9380f35acc5768e2bce8af8eb67ea66c8844b329
4
+ data.tar.gz: 6a1d7fc1b3c3a37d42f548ec4ad1c45bc5e4c81ab45565abed76ffc5f6724706
5
5
  SHA512:
6
- metadata.gz: c6f550e480b3628e14b0397a97fdf699856fd5be0b59d6ef9b1f7e0441055eac65af5ae39199f55e135feeb06b5c90dbeaa0fbd5a5ed0234df6acef8580dbe1b
7
- data.tar.gz: f973afc84095e8007d0e08b961691f1a78491c6ff966652c25473ded4e00be9faa0d2e2aa3fb6c2454e85b78b51d3b99a2859892524a3661f8d2306eaae80ddd
6
+ metadata.gz: 8373ebc44e59346de4f31d29d05b0b4a2763529efc7b2ddfee808337cb5b9b9b44b77e2227957836b2d006868adb6beab7dcd3c0b67c85bcd1ef491dc425e7dc
7
+ data.tar.gz: 01236db145271047de1343ce41e5914081876b60262c3f0b0ac2dff50148634cba7a412abefad09e2779ccb7974d2988dc4f207e0812188b0853102708a65f52
@@ -41,6 +41,7 @@ module RSpec
41
41
  # Trunk holds everything this gem defines (the native extension defines the
42
42
  # module and its classes: TestReport, Status, CIInfo, ...). Nothing is added to
43
43
  # the global namespace or to core classes; test/namespace_spec.rb enforces that.
44
+ # trunk-ignore(rubocop/Metrics/ModuleLength)
44
45
  module Trunk
45
46
  ANSI_ESCAPE_PATTERN = %r{(?:\e[@-Z\\-_]|\e\[[0-?]*[ -/]*[@-~])}
46
47
 
@@ -138,9 +139,71 @@ module RSpec
138
139
  end
139
140
 
140
141
  def parent_name(example)
141
- name = example.example_group.metadata[:description]
142
+ name = description(example.example_group.metadata)
142
143
  name.empty? ? 'rspec' : name
143
144
  end
145
+
146
+ # The example's full_description, rebuilt with .description at every level.
147
+ def full_description(example)
148
+ group = group_full_description(example.example_group.metadata)
149
+ own = description(example.metadata)
150
+ group.empty? ? own : "#{group} #{own}"
151
+ end
152
+
153
+ # RSpec's metadata[:description], rebuilt from metadata[:description_args].
154
+ # RSpec turns those args into text with #to_s, which for an object without its
155
+ # own #to_s, or an anonymous class, includes its memory address. That gives the
156
+ # test a new name, and so a new id, on every run. Those args are named by class
157
+ # instead. Generated descriptions (`it { is_expected.to ... }`) have no args and
158
+ # are used as RSpec built them.
159
+ def description(metadata)
160
+ parent, child = metadata[:description_args]
161
+ return metadata[:description].to_s if metadata[:description_args].empty?
162
+ return description_arg(parent) unless child
163
+ return description_arg(child) if description_arg(parent) == ''
164
+
165
+ description_arg(parent) + description_separator(parent, child) + description_arg(child)
166
+ end
167
+
168
+ def group_full_description(metadata)
169
+ parent = metadata[:parent_example_group]
170
+ return description(metadata) unless parent
171
+
172
+ group_full_description(parent) +
173
+ description_separator(parent[:description_args].last, metadata[:description_args].first) +
174
+ description(metadata)
175
+ end
176
+
177
+ # As in RSpec: `describe Foo, '#bar'` is "Foo#bar", not "Foo #bar".
178
+ def description_separator(parent_arg, child_arg)
179
+ parent_arg.is_a?(Module) && /^(?:#|::|\.)/.match?(child_arg.to_s) ? '' : ' '
180
+ end
181
+
182
+ def description_arg(arg)
183
+ if arg.is_a?(Module)
184
+ arg.name || anonymous_module_name(arg)
185
+ elsif default_to_s?(arg)
186
+ "#<#{arg.class.name || anonymous_module_name(arg.class)}>"
187
+ else
188
+ arg.to_s
189
+ end
190
+ end
191
+
192
+ def anonymous_module_name(mod)
193
+ return '#<Module>' unless mod.is_a?(Class)
194
+
195
+ superclass = mod.superclass
196
+ superclass = superclass.superclass while superclass && superclass.name.nil?
197
+ superclass ? "#<Class < #{superclass.name}>" : '#<Class>'
198
+ end
199
+
200
+ # Kernel's method, so an object whose own #method means something else
201
+ # (e.g. an HTTP request's verb) is still checked.
202
+ def default_to_s?(arg)
203
+ Kernel.instance_method(:method).bind_call(arg, :to_s).owner == Kernel
204
+ rescue TypeError # a BasicObject
205
+ false
206
+ end
144
207
  end
145
208
 
146
209
  # ANSI colors for the gem's console output, without patching String.
@@ -219,7 +282,7 @@ module RSpec
219
282
  unless quarantining_disabled?
220
283
  puts Colors.yellow("Test failed, checking if it can be quarantined: `#{example.location}`")
221
284
  end
222
- result = report.is_quarantined(example.trunk_id, example.full_description, Trunk.parent_name(example),
285
+ result = report.is_quarantined(example.trunk_id, Trunk.full_description(example), Trunk.parent_name(example),
223
286
  classname, file)
224
287
 
225
288
  if result.quarantine_lookup_failed
@@ -457,7 +520,7 @@ module RSpec
457
520
  failure_message = failure_message[0...MAX_TEXT_FIELD_SIZE] if failure_message.length > MAX_TEXT_FIELD_SIZE
458
521
  backtrace = backtrace[0...MAX_TEXT_FIELD_SIZE] if backtrace.length > MAX_TEXT_FIELD_SIZE
459
522
  # TODO: should we use concatenated string or alias when auto-generated description?
460
- name = example.full_description
523
+ name = Trunk.full_description(example)
461
524
  file, classname = Trunk.file_and_classname(example)
462
525
  line = example.metadata[:line_number]
463
526
  started_at = example.execution_result.started_at.to_f
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec_trunk_flaky_tests
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.1.pre.beta.1
4
+ version: 0.16.2.pre.beta.3
5
5
  platform: aarch64-linux-gnu
6
6
  authors:
7
7
  - Trunk Technologies, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-10-19 00:00:00.000000000 Z
11
+ date: 2026-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-core