assert2 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/assert2.rb +18 -0
- metadata +1 -1
data/lib/assert2.rb
CHANGED
@@ -245,6 +245,24 @@ module Test; module Unit; module Assertions
|
|
245
245
|
flunk diagnose(diagnostic, got, caller[0], options, block)
|
246
246
|
end # "You're a looney!" -- King Arthur
|
247
247
|
|
248
|
+
def deny_(diagnostic = nil, options = {}, &block)
|
249
|
+
# "None shall pass!" --the Black Knight
|
250
|
+
|
251
|
+
options[:keep_diagnostics] or add_diagnostic :clear
|
252
|
+
|
253
|
+
begin
|
254
|
+
got = block.call(*options[:args]) or (add_assertion and return true)
|
255
|
+
rescue FlunkError
|
256
|
+
raise
|
257
|
+
rescue => got
|
258
|
+
add_exception got
|
259
|
+
end
|
260
|
+
|
261
|
+
flunk diagnose(diagnostic, got, caller[0], options, block)
|
262
|
+
end # "You're a looney!" -- King Arthur
|
263
|
+
|
264
|
+
# FIXME document why this deny_ is here, and how to alias it back to deny
|
265
|
+
|
248
266
|
alias denigh deny # to line assert{ ... } and
|
249
267
|
# denigh{ ... } statements up neatly!
|
250
268
|
|