[rspec-users] How to spec an attachment_fu model

Jerry West jerry.west at ntlworld.com
Wed Aug 22 14:20:26 EDT 2007

I think you need to clarify what you mean by 'spec an attachment_fu model'.

Do you want the validates_as_attachment to succeed with your test data, 
for instance?  If so, simply stub the call: 
Picture.should_receive(:validates_as_attachment) so that you can be 
confident the model does the right thing (ensuring it is validated in 
real life) but the real validation code is never called and so never 
added to the validation chain, so your test models will save without 
hassle.  I think that's the gist of your problem - you can't get test 
model instances to validate and so cannot write meaningful tests?

Alternatively you may have to include your failing specs so we can 
understand your situation more clearly.

Best wishes,

More information about the rspec-users mailing list