[rspec-users] error message for expect{}.should

Andrew Premdas apremdas at gmail.com
Mon Aug 27 09:55:16 UTC 2012

Hi all,

Having not done any speccing for a few weeks I just spent ages puzzling
over why the following code wasn't working

      it "should require a client" do
        expect{ }.should raise_error ArgumentError

and giving me a

      expected ArgumentError, got #<NoMethodError: undefined method `call'
for #<RSpec::Expectations:

A bit of googling pointed to the fact that I should be using `expect{}.to`,
and reminded me that I have made this mistake more than once in the past.

My question/request is, can we have a better error message for this
mistake, something telling us not to use should with expect.

All best

Andrew Premdas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20120827/69034ac6/attachment-0001.html>

More information about the rspec-users mailing list