rspec_trunk_flaky_tests 0.16.3 → 0.17.0.pre.beta.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/lib/trunk_spec_helper.rb +7 -46
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 521889ec673ef44681f582d65ca7a1a0069c9d8467d2613a0467632fe572abd6
|
|
4
|
+
data.tar.gz: 306a17db08fcf4769de7508f1e1fd30355e385c481a6e7dae7373ef085e13fb1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0ac339db48acb0b6ec7b4e5b7cc6cc49589a5d2b1ab4e7a51e4e92d0f3cf657bf7143eebed1ea119fb2f84afc4adfb25c755a03e9ceaa42dcc8694cd0c92d1bd
|
|
7
|
+
data.tar.gz: 68a60c42844955fc1d2cf3ebfc131be2270c9ece8a8a59296c0fde4d60c9dfb2731482b38ad8d6af99e812d234748c1fea8f13faf9afbd46c9346781afc8f4b9
|
data/lib/trunk_spec_helper.rb
CHANGED
|
@@ -45,15 +45,6 @@ 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
|
-
|
|
57
48
|
# Knapsack example detector instantiates all test cases in order to determine how to shard them
|
|
58
49
|
# These instantiations should not generate test bundles, so we
|
|
59
50
|
# disable the gem when running under knapsack_pro:rspec_test_example_detector
|
|
@@ -189,51 +180,21 @@ module RSpec
|
|
|
189
180
|
end
|
|
190
181
|
|
|
191
182
|
def description_arg(arg)
|
|
192
|
-
if
|
|
193
|
-
|
|
183
|
+
if arg.is_a?(Module)
|
|
184
|
+
arg.name || anonymous_module_name(arg)
|
|
194
185
|
elsif default_to_s?(arg)
|
|
195
|
-
|
|
196
|
-
"#<#{module_description(klass, MODULE_TO_S.bind_call(klass))}>"
|
|
186
|
+
"#<#{arg.class.name || anonymous_module_name(arg.class)}>"
|
|
197
187
|
else
|
|
198
188
|
arg.to_s
|
|
199
189
|
end
|
|
200
190
|
end
|
|
201
191
|
|
|
202
192
|
def anonymous_module_name(mod)
|
|
203
|
-
return '#<Module>' unless
|
|
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
|
|
193
|
+
return '#<Module>' unless mod.is_a?(Class)
|
|
218
194
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
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
|
|
195
|
+
superclass = mod.superclass
|
|
196
|
+
superclass = superclass.superclass while superclass && superclass.name.nil?
|
|
197
|
+
superclass ? "#<Class < #{superclass.name}>" : '#<Class>'
|
|
237
198
|
end
|
|
238
199
|
|
|
239
200
|
# Kernel's method, so an object whose own #method means something else
|