:panda_face: Added tests for after/before hooks

https://github.com/capistrano/capistrano/issues/1004

The changes of #938 affect the order the task executes. The "prerequisite" task seems to be running as
if it was defined in a after block, which makes sense, since it is now invoked by the task instead of being a prerequisite.

Since there were missed tests and @juanibiapina added simple tests in #1005, and were modified in this commit to cover
current business logic of the master.