jfrankov
2009-May-05 00:17 UTC
[rspec-users] [Cucumber] undefined method `record'' for #<Class:0x2473e3c> (NoMethodError)
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
David Chelimsky
2009-May-05 05:45 UTC
[rspec-users] [Cucumber] undefined method `record'' for #<Class:0x2473e3c> (NoMethodError)
On Mon, May 4, 2009 at 5:17 PM, jfrankov <jfrankov at 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).recordThis 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?> > Thanks! > -Jason > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >