Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add specs for ArgumentError#message and #inspect

  • Loading branch information...
commit 4b388917824c266e739216158f000c34feaa9451 1 parent ec34442
@tsion tsion authored
View
9 spec/core/exception/arguments_spec.rb
@@ -0,0 +1,9 @@
+require File.expand_path('../../../spec_helper', __FILE__)
+
+describe "ArgumentError" do
+ it "uses its internal message in #inspect" do
+ lambda { 1.+(2, 3) }.should raise_error(ArgumentError) do |e|
+ e.inspect.should == "#<ArgumentError: method '+': given 2, expected 1>"
+ end
+ end
+end
View
4 spec/ruby/core/exception/arguments_spec.rb
@@ -4,4 +4,8 @@
it "is a subclass of StandardError" do
StandardError.should be_ancestor_of(ArgumentError)
end
+
+ it "gives its own class name as message if it has no message" do
+ ArgumentError.new.message.should == "ArgumentError"
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.