rspec_trunk_flaky_tests 0.16.2.pre.beta.4-aarch64-linux-gnu → 0.16.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: 0ca903837d133f8bc9697d02304aefd25b418c2354ddd4fa393c3d7e1f1e9e7c
4
- data.tar.gz: 64ada43427a7f3721dd09f6e3c784a24f5be71666f2a9ac1444aef01dd8c6ad5
3
+ metadata.gz: 4c886036f87a2cb615e5e22afeb726a75cd2723df611e5fa71595855dd8fce9f
4
+ data.tar.gz: b4d8b243853ca573c640abeb1acfda913ee7b268dc5a05172a7abdfc35ccdbb1
5
5
  SHA512:
6
- metadata.gz: e41aff59fc85dce91107915b0a4856537cf6c64f8ae313a5ac576ea8630b4329c4c4f098330d968b043ff25fa8b0e87cc443feedcb8afb6b41d18cc4d554b32f
7
- data.tar.gz: c16d278a950e875c432b380e33bc7a87e3b4b86691eb0ef9d668faac449ab5be6987da446b336374e767826d4cf9b1746847090b12e6e274b318f2b75b9a0954
6
+ metadata.gz: c8b9b2f28b4b4d4c33f4a2466712ac91aae2c3ae54c3d668fef948dca0b6386f38052459bc3f0f9bc1ee7ad118d27e57487c2d0b89eafcaa219cb522d9ee60e9
7
+ data.tar.gz: ac3969de9582612b329daecdd1e09e56d135dfd361e3d91be7804a6967f50570327eaf37a07688a03492c64931c117259e0ef5b3487d3cb2d25fe6577a78eace
@@ -45,6 +45,15 @@ module RSpec
45
45
  module Trunk
46
46
  ANSI_ESCAPE_PATTERN = %r{(?:\e[@-Z\\-_]|\e\[[0-?]*[ -/]*[@-~])}
47
47
 
48
+ CORE_METHODS = {
49
+ name: [Module.instance_method(:name), String],
50
+ class: [Kernel.instance_method(:class), Module]
51
+ }.freeze
52
+ CLASS_SUPERCLASS = Class.instance_method(:superclass)
53
+ KERNEL_IS_A = Kernel.instance_method(:is_a?)
54
+ MODULE_TO_S = Module.instance_method(:to_s)
55
+ MEMORY_ADDRESS = /:0x\h+>/
56
+
48
57
  # Knapsack example detector instantiates all test cases in order to determine how to shard them
49
58
  # These instantiations should not generate test bundles, so we
50
59
  # disable the gem when running under knapsack_pro:rspec_test_example_detector
@@ -180,21 +189,51 @@ module RSpec
180
189
  end
181
190
 
182
191
  def description_arg(arg)
183
- if arg.is_a?(Module)
184
- arg.name || anonymous_module_name(arg)
192
+ if core_is_a?(arg, Module)
193
+ module_description(arg, arg.to_s)
185
194
  elsif default_to_s?(arg)
186
- "#<#{arg.class.name || anonymous_module_name(arg.class)}>"
195
+ klass = core_call(arg, :class)
196
+ "#<#{module_description(klass, MODULE_TO_S.bind_call(klass))}>"
187
197
  else
188
198
  arg.to_s
189
199
  end
190
200
  end
191
201
 
192
202
  def anonymous_module_name(mod)
193
- return '#<Module>' unless mod.is_a?(Class)
203
+ return '#<Module>' unless core_is_a?(mod, Class)
204
+
205
+ superclass = CLASS_SUPERCLASS.bind_call(mod)
206
+ superclass = CLASS_SUPERCLASS.bind_call(superclass) while superclass && module_name(superclass).nil?
207
+ superclass ? "#<Class < #{module_name(superclass)}>" : '#<Class>'
208
+ end
209
+
210
+ # `described` is the module's #to_s, which is RSpec's (and so 0.16.1's) name for it,
211
+ # kept unless it has an address in it.
212
+ def module_description(mod, described)
213
+ return described unless MEMORY_ADDRESS.match?(described)
214
+
215
+ name = module_name(mod)
216
+ name.nil? || name.empty? ? anonymous_module_name(mod) : name
217
+ end
194
218
 
195
- superclass = mod.superclass
196
- superclass = superclass.superclass while superclass && superclass.name.nil?
197
- superclass ? "#<Class < #{superclass.name}>" : '#<Class>'
219
+ def module_name(mod)
220
+ core_call(mod, :name)
221
+ end
222
+
223
+ # The arg's own method when it works as core's does, else core's: a class may define
224
+ # .name for something else (private, or taking arguments).
225
+ def core_call(obj, method_name)
226
+ core, type = CORE_METHODS.fetch(method_name)
227
+ value = obj.public_send(method_name)
228
+ value.is_a?(type) ? value : core.bind_call(obj)
229
+ rescue StandardError, NotImplementedError
230
+ core.bind_call(obj)
231
+ end
232
+
233
+ def core_is_a?(obj, type)
234
+ KERNEL_IS_A.bind_call(obj, type)
235
+ rescue TypeError # a BasicObject
236
+ false
198
237
  end
199
238
 
200
239
  # Kernel's method, so an object whose own #method means something else
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.2.pre.beta.4
4
+ version: 0.16.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-27 00:00:00.000000000 Z
11
+ date: 2026-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-core