diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2007-12-05 14:11:34 +0100 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2007-12-05 14:11:34 +0100 |
commit | 17bf327a39bea0b4d9473cc718c369558f7dc3ba (patch) | |
tree | 092fddb654a19305b67016cc4f07bbef47ee1fbb /lib | |
parent | 17c8a9c07eb67c60174c762a15f5aebe8ee902c7 (diff) | |
download | bacon-17bf327a39bea0b4d9473cc718c369558f7dc3ba.tar.gz bacon-17bf327a39bea0b4d9473cc718c369558f7dc3ba.tar.xz bacon-17bf327a39bea0b4d9473cc718c369558f7dc3ba.zip |
Add flunking
darcs-hash:20071205131134-4fc50-f212f6e81f9439f8171234b379dbf4852f7ed9e2.gz
Diffstat (limited to 'lib')
-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 |