The issue required the restoring prepend_before and append_after. However, on taking a look at the code it seems to me like "append_after" and the current "after" method would function the same way. Hence I've only added prepend_before. Please let me know if there something I'm missing on the append_after and I will get it working
Adding prepend before
After hooks are run in reverse: https://github.com/rspec/rspec-core/blob/master/lib/rspec/core/hooks.rb#L80.
What we should probably do is change it so after hooks are stored in reverse and run in the stored order, and then append_after will make sense. Also - the way it worked in rspec-1 was that we had
def prepend_before; ...; end
def append_before; ...; end
def prepend_after; ...; end
def append_after; ...; end
alias_method :before, :append_before # so they are stored in order
alias_method :after, :prepend_after # so they are stored in reverse order
That way the ordering is more self-evident.
Merge branch 'master' into issue-126
Adding append_after, prepend_after, changes to after hooks storage an…
…d run method
You should be able to see the changes on the latest commit of this pull request. Let me know if this is what you were think of
Hook collections are all the same now, so we only need one type.
rdoc tweaks for #579
refactor the [prepend|append]_[before|after] examples
Changelog for #579
Actually, this doesn't solve the problem from rspec/rspec-rails#391 yet because we need to be able to prepend_before in a group and have it run before the hooks declared in global config :) I'm looking into a solution for this.
Agreed..Will look into it too
@preethiramdev I've been working on it on and off for the last week or two - basically refactoring the entire hooks functionality. You're welcome to try something, but I'm likely to go with the changes I'm already midstream on.