-
Notifications
You must be signed in to change notification settings - Fork 1
Description
We should add helpers for running a before and after callback.
These are special callbacks that we typically don't run in test suites. This gives the user the ability to put authorization checking into a before callback for all of its handlers but not have to worry about stubbing it out for every test.
It would be nice though if we had a way to run these via the runner to test them. Currently, the user has to do something like:
@handler_class.before_callbacks.each do |callback|
@handler.instance_eval(&callback)
endThis requires knowing to much about runners and handlers. We should either add an option when creating a test runner to run the callbacks:
@runner = test_runner(@handler_class, :run_before_callbacks => true)or we should add a method to the runner that can be called (maybe both?):
@runner.run_before_callbacksThe benefit of the first option is that we can run the callbacks when they normally would be run, before init! is called. The "problem" with it is you can no longer write that attribute to the handler if for some reason a handler had a run_before_callbacks writer.
Related to: redding/deas#180