Rspec-core: around(:suite) hooks seem completely broken

Created on 7 Aug 2017  ·  3Comments  ·  Source: rspec/rspec-core

If you put an around(:suite) hook in your spec_helper.rb file, you seem to always get this warning:

WARNING: `around(:suite)` hooks are only supported on the RSpec configuration object.
This `around(:suite)` hook, registered on an example group, will be ignored.

And then it blissfully ignores your hook, even if it has actually been defined on the RSpec configuration object. Neither of the following syntaxes seem to work:

RSpec.configuration.around(:suite) do |example|

RSpec.configure do |config|
  config.around(:suite) do |example|

To duplicate the issue, just check out this little two-file repository and run rspec in the root:

https://github.com/fimmtiu/rspec-around-suite-bug

~/rspec-around-suite-bug$ rspec
WARNING: `around(:suite)` hooks are only supported on the RSpec configuration object.
This `around(:suite)` hook, registered on an example group, will be ignored. Called
from /.../rspec-around-suite-bug/spec/spec_helper.rb:1:in `<top (required)>'.
WARNING: `around(:suite)` hooks are only supported on the RSpec configuration object.
This `around(:suite)` hook, registered on an example group, will be ignored. Called
from /.../rspec-around-suite-bug/spec/spec_helper.rb:7:in `block in <top (required)>'.
.

Finished in 0.00043 seconds (files took 0.07965 seconds to load)
1 example, 0 failures

Most helpful comment

The warning message is a bit misleading.

We've never supported around(:suite) hooks.

vs

WARNING: `around(:suite)` hooks are only supported on the RSpec configuration object.

All 3 comments

We've never supported around(:suite) hooks. Do you want to take a stab at adding support for them?

Really? That explains it. Yeah, things are a bit nuts at the moment but I'll try to find some time next month to have a look at it.

The warning message is a bit misleading.

We've never supported around(:suite) hooks.

vs

WARNING: `around(:suite)` hooks are only supported on the RSpec configuration object.
Was this page helpful?
0 / 5 - 0 ratings