From a5a6a2612c3b615081a3befa6b0d061d2bf3e94a Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Thu, 26 Mar 2020 21:04:50 +0000 Subject: [PATCH] Add information about hook defaults to cucumber scenario --- features/hooks/before_and_after_hooks.feature | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/features/hooks/before_and_after_hooks.feature b/features/hooks/before_and_after_hooks.feature index 07a9f7b5cd..d47bb87d93 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,6 +259,8 @@ Feature: `before` and `after` hooks """ before context before example + also before example but by default + also after example but by default after example .after context """