technicalpickles/capistrano-spec — pull request #14 by jhbabon (2013-06-26 09:44:41+00:00)
Title: Prevent false positives in callback matchers.

When you call the `#callback` matcher and pass an undefined task to the `#before` or `#after` methods of the matcher, this always returns true, even if the `before` callback is not defined in the recipe.

This happens because the `configuration` object inside the specs may not have defined the task for the callback. Then, when the matcher method tries to find the task, it always find a `nil` object which always returns true in the capistrano method `#applies_to?`.

The `#callback` matcher should check if a capistrano callback has been defined, not if a taks exists, that's why I stub the task if isn't found. That way you can prevent false positives.