@@ -60,7 +60,8 @@ module Hooks
60
60
# before(:example) # Declared in the current group.
61
61
#
62
62
# If more than one `before` is declared within any one scope, they are run
63
- # in the order in which they are declared.
63
+ # in the order in which they are declared. Any `around` hooks will execute
64
+ # later than any `before` hook regardless of scope.
64
65
#
65
66
# ### Conditions
66
67
#
@@ -261,7 +262,8 @@ def prepend_before(*args, &block)
261
262
#
262
263
# This is the reverse of the order in which `before` hooks are run.
263
264
# Similarly, if more than one `after` is declared within any one scope,
264
- # they are run in reverse order of that in which they are declared.
265
+ # they are run in reverse order of that in which they are declared. Also
266
+ # `around` hooks will all have run before any after hooks are invoked.
265
267
#
266
268
# @note The `:example` and `:context` scopes are also available as
267
269
# `:each` and `:all`, respectively. Use whichever you prefer.
@@ -329,6 +331,12 @@ def append_after(*args, &block)
329
331
# around(:example) {|ex| Database.transaction(&ex)}
330
332
# around(:example) {|ex| FakeFS(&ex)}
331
333
#
334
+ # ### Order
335
+ #
336
+ # All `around` hooks execute immediately surrounding an example, this means
337
+ # that all `before` hooks will have run and no `after` hooks will have run yet.
338
+ #
339
+ # They are not a synonym for `before`/`after`.
332
340
def around ( *args , &block )
333
341
hooks . register :prepend , :around , *args , &block
334
342
end
0 commit comments