INCLUDE_DATA

ActiveRecord callbacks in specs?

While writing specs for my models, I sometimes found them failing for no apparent reason. After a bit of investigation, I found that my callbacks in the models where not being called. My solution? I call them myself, like so:

it "should set profile flag" do
  @photo.send(:before_create)
  @photo.save
  @photo.profile_pic = true
  @photo[:options][:profile_pic].should be_true
end

I find that this is a problem only with before_create and not with after_create. Not sure why this is hapenning, but this is waht worked for me.