Closed pvertenten closed 10 years ago
Thanks for the pr, I'll have a look at this in the next days!
Ok, the suggested API is looking good to go.
As you said, there need to be tests and documentation for this example, you can also update the readme if you like. Concerning the implementation, I think the best way to handle the added matcher complexity is to extract it into private methods to improve readability.
Looking forward to merging this!
Closing. I sent another pull request with all the updates
Added support for object based callbacks in addition to the already supported :symbol callbacks.
So now both of the following will work.
after_create :track_activity it { should callback(:track_activity).after(:create) }
and
after_create ActivityTracker.new it { should callback(ActivityTracker).after(:create) }
I am possibly using some undocumented apis, but used respond_to? to guard against api changes.
Anyway, I am sending you this pull request to get the conversation started about incorporating this if that is what you end up wanting.
Still would need to add tests and update the documentation, and it could be made to further test items on the callback class as well.