Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stormbrew/296153 to your computer and use it in GitHub Desktop.
Save stormbrew/296153 to your computer and use it in GitHub Desktop.
From 74958fc6092010d8f9d55e569d4276e9b6109523 Mon Sep 17 00:00:00 2001
From: Graham <graham-git@stormbrew.ca>
Date: Thu, 28 Jan 2010 15:46:33 -0700
Subject: [PATCH 1/2] Updated spec for issue when raising an object instance with a message
---
spec/ruby/core/exception/exception_spec.rb | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/spec/ruby/core/exception/exception_spec.rb b/spec/ruby/core/exception/exception_spec.rb
index 78a8927..57d5403 100644
--- a/spec/ruby/core/exception/exception_spec.rb
+++ b/spec/ruby/core/exception/exception_spec.rb
@@ -67,5 +67,19 @@ describe "Exception#exception" do
e2.should be_an_instance_of(RuntimeError)
e2.message.should == :message
end
-
+
+ class CustomArgumentError < StandardError
+ attr_reader :val
+ def initialize(val)
+ @val = val
+ end
+ end
+
+ it "returns an exception of the same class as self with the message given as argument, but without reinitializing" do
+ e = CustomArgumentError.new(:boom)
+ e2 = e.exception(:message)
+ e2.should be_an_instance_of(CustomArgumentError)
+ e2.val.should == :boom
+ e2.message.should == :message
+ end
end
--
1.6.1.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment