--- Revision None +++ Revision 393538303231 @@ -0,0 +1,52 @@ +From a3f952616a416480f9f382248c39d0f37b1385b2 Mon Sep 17 00:00:00 2001 +From: Graham +Date: Thu, 28 Jan 2010 15:46:33 -0700 +Subject: [PATCH] Updated spec for issue when raising an object instance with a message + +--- + spec/ruby/language/rescue_spec.rb | 23 +++++++++++++++++++++++ + 1 files changed, 23 insertions(+), 0 deletions(-) + +diff --git a/spec/ruby/language/rescue_spec.rb b/spec/ruby/language/rescue_spec.rb +index 2bd01eb..1b1bd11 100644 +--- a/spec/ruby/language/rescue_spec.rb ++++ b/spec/ruby/language/rescue_spec.rb +@@ -3,6 +3,12 @@ class SpecificExampleException < StandardError + end + class OtherCustomException < StandardError + end ++class CustomArgumentException < StandardError ++ attr_reader :val ++ def initialize(val) ++ @val = val ++ end ++end + + def exception_list + [SpecificExampleException, ZeroDivisionError] +@@ -24,6 +30,23 @@ describe "The rescue keyword" do + e.message.should == "some text" + end + end ++ ++ it "can take an object instance instead of a class to raise" do ++ begin ++ raise CustomArgumentException.new(1) ++ rescue CustomArgumentException => e ++ e.val.should == 1 ++ end ++ end ++ ++ it "can take an object instance instead of a class to raise as well as a message" do ++ begin ++ raise CustomArgumentException.new(1), "some text" ++ rescue CustomArgumentException => e ++ e.val.should == 1 ++ e.message.should == "some text" ++ end ++ end + + it "can rescue multiple raised exceptions with a single rescue block" do + lambda do +-- +1.6.1.2