Model does not implement AR methods

44 views
Skip to first unread message

croceldon

unread,
Feb 16, 2015, 12:49:40 PM2/16/15
to rs...@googlegroups.com
I'm running into this error after updating to rspec 3.2:

  EmProfiOption does not implement #find

EmProfiOption is an AR model.  Here's the line causing the trouble:

  allow(EmProfiOption).to receive(:find).and_return(profi.em_profi_option)

This occurs even if I add the following:

  EmProfiOption.define_attribute_methods

Any ideas on how to resolve?

Thanks much

Xavier Shay

unread,
Feb 16, 2015, 12:53:54 PM2/16/15
to rs...@googlegroups.com
`#find` is talking about an instance method, not a class method.
 
You need to define it:
 
class EmProfiOption < ActiveRecord::Base
  def find(*args); super end
end
 
 
Cheers,
Xavier
--
You received this message because you are subscribed to the Google Groups "rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rspec+un...@googlegroups.com.
To post to this group, send email to rs...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
 

Jon Rowe

unread,
Feb 16, 2015, 5:23:44 PM2/16/15
to rs...@googlegroups.com
Did Xavier’s suggestion fix your issue? If not can you gist more of your spec?

Jon Rowe
---------------------------

Reply all
Reply to author
Forward
0 new messages