Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add information about hook defaults to cucumber scenario #2708

Merged
merged 1 commit into from Mar 27, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions 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