Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Revert "Follow r30455: Error#to_s should ensure that the value return…

…ed is a string."

This reverts commit c7fe573.
  • Loading branch information...
commit 00b45adb4de8476dc27f540a2ea53d55a12c95fd 1 parent 420271c
@jfirebaugh authored
Showing with 21 additions and 54 deletions.
  1. +8 −22 core/exception/equal_value_spec.rb
  2. +13 −32 core/exception/exception_spec.rb
View
30 core/exception/equal_value_spec.rb
@@ -29,28 +29,14 @@
one.should == two
end
- ruby_version_is '1.9' ... '1.9.3' do
- it "returns true if the two exceptions inherit from Exception but have different classes" do
- one = RuntimeError.new(:message)
- one.set_backtrace [File.dirname(__FILE__)]
- one.should be_kind_of(Exception)
- two = TypeError.new(:message)
- two.set_backtrace [File.dirname(__FILE__)]
- two.should be_kind_of(Exception)
- one.should == two
- end
- end
-
- ruby_version_is '1.9.3' do
- it "returns false if the two exceptions inherit from Exception but have different classes" do
- one = RuntimeError.new(:message)
- one.set_backtrace [File.dirname(__FILE__)]
- one.should be_kind_of(Exception)
- two = TypeError.new(:message)
- two.set_backtrace [File.dirname(__FILE__)]
- two.should be_kind_of(Exception)
- one.should_not == two
- end
+ it "returns true if the two exceptions inherit from Exception but have different classes" do
+ one = RuntimeError.new(:message)
+ one.set_backtrace [File.dirname(__FILE__)]
+ one.should be_kind_of(Exception)
+ two = TypeError.new(:message)
+ two.set_backtrace [File.dirname(__FILE__)]
+ two.should be_kind_of(Exception)
+ one.should == two
end
it "returns true if the two objects subclass Exception and have the same message and backtrace" do
View
45 core/exception/exception_spec.rb
@@ -61,6 +61,13 @@
e.should == e.exception(e)
end
+ it "returns an exception of the same class as self with the message given as argument" do
+ e = RuntimeError.new
+ e2 = e.exception(:message)
+ e2.should be_an_instance_of(RuntimeError)
+ e2.message.should == :message
+ end
+
class CustomArgumentError < StandardError
attr_reader :val
def initialize(val)
@@ -68,37 +75,11 @@ def initialize(val)
end
end
- ruby_version_is '' ... '1.9.3' do
- it "returns an exception of the same class as self with the message given as argument" do
- e = RuntimeError.new
- e2 = e.exception(:message)
- e2.should be_an_instance_of(RuntimeError)
- e2.message.should == :message
- 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
-
- ruby_version_is '1.9.3' do
- it "returns an exception of the same class as self with the message given as argument" do
- e = RuntimeError.new
- e2 = e.exception(:message)
- e2.should be_an_instance_of(RuntimeError)
- e2.message.should == 'message'
- 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
+ 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
Please sign in to comment.
Something went wrong with that request. Please try again.