[rspec-devel] [ rspec-Bugs-12215 ] Misleading error message when passing string as first argument to raise_error

noreply at rubyforge.org noreply at rubyforge.org
Mon Jul 23 08:22:13 EDT 2007


Bugs item #12215, was opened at 2007-07-12 05:39
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=12215&group_id=797

Category: expectation module
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Brian Takita (btakita)
Assigned to: Nobody (None)
Summary: Misleading error message when passing string as first argument to raise_error

Initial Comment:
describe "An example with raise_error" do
    it "should provide a nice error message when passed a string as a first argument" do
      proc do
        proc do
          raise "foobar"
        end.should raise_error("Called 4 times. Expected at most 3 times.")
      end.should raise_error(ArgumentError, "raise_error expects an Exception Class as its first argument")
    end
end

----------------------------------------------------------------------

>Comment By: David Chelimsky (dchelimsky)
Date: 2007-07-23 12:22

Message:
Bueller? Bueller?

----------------------------------------------------------------------

Comment By: David Chelimsky (dchelimsky)
Date: 2007-07-12 05:44

Message:
How about allowing the first argument to be a String? That way, especially nice for RuntimeErrors, you can just specify the message and be done with it, unless you want to be more specific.

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=12215&group_id=797


More information about the rspec-devel mailing list