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

**URL:** <https://www.ruby-forum.com/t/cucumber-undefined-method-record-for-class-0x2473e3c-nomethoderror/167183>\
**Category:** RSpec\
**Created:** [May 5, 2009, 7:39am UTC](https://www.ruby-forum.com/t/cucumber-undefined-method-record-for-class-0x2473e3c-nomethoderror/167183 "2009-05-05T07:39:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jfrankov](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/87869e/32.png) [@jfrankov](https://www.ruby-forum.com/u/jfrankov)\
**Post date:** [May 5, 2009, 7:39am UTC](https://www.ruby-forum.com/t/cucumber-undefined-method-record-for-class-0x2473e3c-nomethoderror/167183/1 "2009-05-05T07:39:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jfrankov](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/87869e/32.png) [@jfrankov](https://www.ruby-forum.com/u/jfrankov)\
**Post date:** [May 5, 2009, 7:47am UTC](https://www.ruby-forum.com/t/cucumber-undefined-method-record-for-class-0x2473e3c-nomethoderror/167183/2 "2009-05-05T07:47:36Z")

</div>

On Mon, May 4, 2009 at 5:17 PM, jfrankov [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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?
