From bc0df844c7b20f30e456c493e086a9a871471550 Mon Sep 17 00:00:00 2001 From: Eloy Duran Date: Mon, 31 Aug 2009 23:36:56 +0200 Subject: Revert old change that was made because 1.9.0 couldn't rescue a splatted array of Exception classes. MacRuby currently can't use when with the same array and 1.9.2dev does. Also some other minor changes which didn't work currently on 1.9.2dev, but are nicer anyway imo. --- lib/bacon.rb | 13 ++----------- test/spec_bacon.rb | 2 +- test/spec_should.rb | 2 +- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/lib/bacon.rb b/lib/bacon.rb index 3b71fd1..ad4df44 100644 --- a/lib/bacon.rb +++ b/lib/bacon.rb @@ -237,17 +237,9 @@ end class Proc def raise?(*exceptions) - exceptions = [RuntimeError] if exceptions.empty? call - - # Only to work in 1.9.0, rescue with splat doesn't work there right now - rescue Object => e - case e - when *exceptions - e - else - raise e - end + rescue *(exceptions.empty? ? RuntimeError : exceptions) => e + e else false end @@ -285,7 +277,6 @@ module Kernel def shared(name, &block) Bacon::Shared[name] = block end end - class Should # Kills ==, ===, =~, eql?, equal?, frozen?, instance_of?, is_a?, # kind_of?, nil?, respond_to?, tainted? diff --git a/test/spec_bacon.rb b/test/spec_bacon.rb index 2d068bc..b1360be 100644 --- a/test/spec_bacon.rb +++ b/test/spec_bacon.rb @@ -1,5 +1,5 @@ $-w,w = nil, $-w -require File.join(File.dirname(__FILE__), '../lib/bacon') +require File.expand_path('../../lib/bacon', __FILE__) $-w = w # Hooray for meta-testing. diff --git a/test/spec_should.rb b/test/spec_should.rb index 30cf36a..4986aa2 100644 --- a/test/spec_should.rb +++ b/test/spec_should.rb @@ -1,4 +1,4 @@ -require File.join(File.dirname(__FILE__), '../lib/bacon') +require File.expand_path('../../lib/bacon', __FILE__) describe "#should shortcut for #it('should')" do -- cgit 1.4.1