[rspec-users] should_raise ain't workin' with the `spec` command

David Beckwith dbitsolutions at gmail.com
Sat Nov 8 01:29:22 EST 2008

Hello my fellow RSpeckers,

I am using the spec command like this:

                spec tokyo_record_spec.rb

And the for some reason the should_raise Rspec command is not
happening with my lambda block:

    it "should raise a NoSuchAttribute error if the attribute 'name'
hasn't been declared yet and you try to create a persisted instance of
the object." do
      lambda {
        User.create( :name => 'Dustin')
      }. should_raise( NoSuchAttribute )

Here is the error:

undefined method `should_raise' for #<Proc:0x006fc7a0 at ./

I'm not sure how the `spec` command actually works, and I'm sure
that's at least one source of my confusion.  Also, I don't know where
`should_raise` is defined either.  If anybody could help me clear the
clouds in my brain, I would greatly appreciate it.  Please point me in
a sunnier direction.

This is straight Ruby code.  It has nothing to do with Rails. My
directory structure looks something like this:


And at the top of /tokyo/tokyo_record_spec.rb I have only require
'tokyo_record' which is a homemade Ruby module that I'm trying to spec
with RSpec.

I am running gem version 1.2.0, RSpec 1.1.9 and hoe 1.8.0 on OS X

Thank you,
David :)

More information about the rspec-users mailing list