Skip to content

Commit ecfeec5

Browse files
committed
dev: improve the pending test helper
so that pending_if displays the right frame
1 parent db88e25 commit ecfeec5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/helper.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -266,19 +266,19 @@ def util_decorate(document, decorator_module)
266266
document.decorate!
267267
end
268268

269-
def pending(msg)
269+
def pending(msg, extra_uplevel = 0)
270270
begin
271271
yield
272272
rescue Minitest::Assertion
273-
skip("pending #{msg} [#{caller(2..2).first}]")
273+
skip("pending #{msg} [#{caller(2 + extra_uplevel, 1).first}]")
274274
end
275-
flunk("pending test unexpectedly passed: #{msg} [#{caller(1..1).first}]")
275+
flunk("pending test unexpectedly passed: #{msg} [#{caller(1 + extra_uplevel, 1).first}]")
276276
end
277277

278278
def pending_if(msg, pend_eh, &block)
279279
return yield unless pend_eh
280280

281-
pending(msg, &block)
281+
pending(msg, 1, &block)
282282
end
283283

284284
# returns the page size in bytes

0 commit comments

Comments
 (0)