From b0602a7143ca94a6639724fcebb3e4e4ecc29fdb Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Wed, 5 Dec 2007 01:58:08 +0100 Subject: Test Context#should.{throw,raise} darcs-hash:20071205005808-4fc50-042ef423f840f7cc0f37003112e8f95794446de0.gz --- lib/bacon.rb | 4 ++++ test/spec_bacon.rb | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/lib/bacon.rb b/lib/bacon.rb index 74d2a94..ada7c8f 100644 --- a/lib/bacon.rb +++ b/lib/bacon.rb @@ -155,6 +155,10 @@ module Bacon def raise?(*args, &block) block.raise?(*args) end + + def throw?(*args, &block) + block.throw?(*args) + end end end diff --git a/test/spec_bacon.rb b/test/spec_bacon.rb index 0f6e95e..2038e8a 100644 --- a/test/spec_bacon.rb +++ b/test/spec_bacon.rb @@ -199,11 +199,15 @@ describe "Bacon" do it "should have should.raise" do lambda { lambda { bla }.should.raise(NameError) }.should succeed lambda { lambda { nil }.should.raise(NameError) }.should fail + + should.raise(NameError) { bla } end it "should have should.throw" do lambda { lambda { throw :foo }.should.throw(:foo) }.should succeed lambda { lambda { :foo }.should.throw(:foo) }.should fail + + should.throw(:foo) { throw :foo } end it "should have should (>, >=, <, <=, ===)" do -- cgit 1.4.1