diff options
Diffstat (limited to 'lib/bacon.rb')
-rw-r--r-- | lib/bacon.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/bacon.rb b/lib/bacon.rb index 64e6504..b73bfe4 100644 --- a/lib/bacon.rb +++ b/lib/bacon.rb @@ -279,9 +279,7 @@ class Should r = yield(@object, *args) if Bacon::Counter[:depth] > 0 - unless @negated ^ r - raise Bacon::Error.new(:failed, description) - end + raise Bacon::Error.new(:failed, description) unless @negated ^ r Bacon::Counter[:requirements] += 1 end @negated ^ r ? r : false @@ -304,4 +302,8 @@ class Should def identical_to(value); self.equal? value; end alias same_as identical_to + + def flunk(reason="Flunked") + raise Bacon::Error.new(:failed, reason) + end end |