Search This Blog

September 21, 2011

Can't find first MyFreakingActiveRecordModel

Can't find first MyFreakingActiveRecordModel.... Do you get this weird sounding error on running your spec for the model? A re-look at the exception should give you some cues. Yeah, it only implies that you don't have a test record for that model in your test environment DB. All you need to do is add a test record to the test DB. If you are using FactoryGirl, and RSpec, the code snippet below shows the way it can be done elegantly.


Lesson: Shoulda requires a record in the DB, well atleast in this case :P