Contrary to documentation,`around` hooks runs before `before`
Created by: rahul342
Subject of the issue
Contrary to documentation,around
hooks runs before before
Describe your issue here. The docs here https://www.rubydoc.info/gems/rspec-core/RSpec%2FCore%2FHooks%3Aaround says -
All around hooks execute immediately surrounding an example, this means that all before hooks will have run and no after hooks will have run yet.
Your environment
- Ruby version: 2.7.1p83
- rspec-core version: 3.9.2
Steps to reproduce
Here's the example I used
RSpec.configure do |config|
config.before(:each) do
puts 'before in configure'
end
end
RSpec.describe "Order" do
before(:each) do
puts 'before in describe'
end
around do |t|
puts 'around started'
t.run
puts 'around exiting'
end
it 'some example' do
end
end
Expected behavior
I would expect the prints in before
to show before the prints in around
since
all before hooks will have run
Actual behavior
This is the output I get
around started
before in configure
before in describe
around exiting