Ruby on Rails before_ callbacks must return true gotcha
Wednesday 29 April 2009
Spent a heck of a long time trying to figure out why my Cucumber tests were failing this afternoon. I assumed it had to do with an API key problem (this test/model involved a spam checking service) until I discovered that “If a before_* callback returns false, all the later callbacks and the associated action are cancelled.” Cucumber was providing no feedback, and I was having no such problems when using the site myself. So I finally discovered, thanks to some other poor souls who went through this same hell before me, that tagging a return true on the end of the method will prevent this:end
