Skip to content

Commit

Permalink
[core] Merge pull request rspec/rspec-core#2708 from rspec/add-defaul…
Browse files Browse the repository at this point in the history
…t-hook-docs

Add information about hook defaults to cucumber scenario

---
This commit was imported from rspec/rspec-core@abc6211.
  • Loading branch information
JonRowe committed May 2, 2020
1 parent 69f29a2 commit d284510
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions rspec-core/features/hooks/before_and_after_hooks.feature
Expand Up @@ -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.

Expand Down Expand Up @@ -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
Expand All @@ -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
"""
Expand Down

0 comments on commit d284510

Please sign in to comment.