Forum: RSpec [Cucumber] undefined method `record' for #<Class:0x2473e3c> (NoMethodError)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E3131298f66e50e5626e96a2848fc665?d=identicon&s=25 jfrankov (Guest)
on 2009-05-05 07:39
(Received via mailing list)
I have a step definition file where I'm saving a model object and want
to use this syntax (it's common, I see it in examples everywhere):

Event.should have(1).record

...but it gives this error:

undefined method `record' for #<Class:0x2473e3c> (NoMethodError)

Am I missing some library or require or something? I added "require
'spec/expectations'" to my env.rb but no change. Any ideas?

Thanks!
-Jason
5d38ab152e1e3e219512a9859fcd93af?d=identicon&s=25 David Chelimsky (Guest)
on 2009-05-05 07:47
(Received via mailing list)
On Mon, May 4, 2009 at 5:17 PM, jfrankov <jfrankov@gmail.com> wrote:
> I have a step definition file where I'm saving a model object and want
> to use this syntax (it's common, I see it in examples everywhere):
>
> Event.should have(1).record

This is an rspec-rails extension of ActiveRecord. It's not cucumber
(or rspec-core).

Try this (no guarantees):

require 'spec/rails/extensions/active_record/base'

That's where it's defined right now, though it might move in the
future. If it works, please file a feature request at lighthouse and
I'll see what I can do about exposing it somewhere more intuitive and
permanent.

Thanks,
David

>
> ...but it gives this error:
>
> undefined method `record' for #<Class:0x2473e3c> (NoMethodError)
>
> Am I missing some library or require or something? I added "require
> 'spec/expectations'" to my env.rb but no change. Any ideas?
This topic is locked and can not be replied to.