On Thu, Sep 25, 2008 at 9:33 AM, Nick Hoffman <[EMAIL PROTECTED]> wrote:

> I noticed in the RSpec documentation that "object.should raise_error" isn't
> enclosed in a begin..rescue..end :
> http://rspec.info/rdoc/classes/Spec/Matchers.html#M000420
>
> However, when I use #raise_error , I have to rescue it, otherwise an actual
> exception is raised and the script bails.
>
> This:
> RentalMap.make_marker('asdf').should raise_error(RuntimeError, 'The 1st
> argument (property) should be a Property')
>

You need to send :should to a Proc:

 lambda { RentalMap.make_marker('asdf') }.should raise_error(blah, blah)

I'll be every RSpec user has made this mistake at least once (in my case,
numerous times). I wonder if it would be possible for the matcher to call
this out?

///ark
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to