diff --git a/features/hooks/before_and_after_hooks.feature b/features/hooks/before_and_after_hooks.feature index 07a9f7b5cd..7865c2386c 100644 --- a/features/hooks/before_and_after_hooks.feature +++ b/features/hooks/before_and_after_hooks.feature @@ -22,6 +22,8 @@ Feature: `before` and `after` hooks after :suite ``` + A bare `before` or `after` hook defaults to the `:example` scope. + `before` and `after` hooks can be defined directly in the example groups they should run in, or in a global `RSpec.configure` block. @@ -231,10 +233,18 @@ Feature: `before` and `after` hooks puts "before example" end + before do + puts "also before example but by default" + end + after(:example) do puts "after example" end + after do + puts "also after example but by default" + end + after(:context) do puts "after context" end @@ -249,7 +259,9 @@ Feature: `before` and `after` hooks """ before context before example + also before example but by default after example + also after example but by default .after context """