Make rspec-expectations and rspec-mocks APIs available in `before(:suite)` hooks
Created by: JonRowe
Currently users get errors if they try to use rspec-expectations or rspec-mocks APIs (e.g. expect(x).to y
or allow(x).to receive
) in a before
or after
:suite
hook. It's not a common need (and not something I've ever wanted!) but for consistency/parity with the other hook types they should be available. It looks like the hooks are intended to run in the context of a SuiteHookContext
object but somehow it's actually being run in the context of nil
(woops!).
See rspec/rspec-mocks#966 for an example use case.