On Jan 28, 2010, at 5:49 pm, Rick DeNatale wrote:
I’d like to write a spec to ensure that this doesn’t regress, but my
imagination is failing me as to how to do it.
Yes: don’t use inheritance for implementations. The bug you describe is
arguably a violation of the Liskov Substitution Principle, ie the
derived class changed the functionality it inherited in a way that broke
the expected behaviour of all derived classes.
If you can write a spec (possibly shared examples) that defines the
contract you expect all controllers to follow - eg display an error
page in this situation - you can run that against all your controllers.
Checking that you call
super doesn’t necessarily give you this
If you want to post #rescue_action_in_public there might be another way,
depending on your code. I’m no Rails guru though.
BTW if this sounds like a rant, it is I am constantly stamping my
feet over the way controllers in Rails, Merb etc are implemented, as
they make writing specs extremely difficult.
Let me know if this is not clear as I’ve thrown the email together in a
hurry before going home for the night…