Method: RSpec.current_scope
- Defined in:
- lib/rspec/core.rb
permalink .current_scope ⇒ Symbol
Get the current RSpec execution scope
Returns (in order of lifecycle):
:suite
as an initial value, this is outside of the test lifecycle.:before_suite_hook
duringbefore(:suite)
hooks.:before_context_hook
duringbefore(:context)
hooks.:before_example_hook
duringbefore(:example)
hooks andaround(:example)
beforeexample.run
.:example
within the example run.:after_example_hook
duringafter(:example)
hooks andaround(:example)
afterexample.run
.:after_context_hook
duringafter(:context)
hooks.:after_suite_hook
duringafter(:suite)
hooks.:suite
as a final value, again this is outside of the test lifecycle.
Reminder, :context
hooks have :all
alias and :example
hooks have :each
alias.
154 155 156 |
# File 'lib/rspec/core.rb', line 154 def self.current_scope RSpec::Support.thread_local_data[:current_scope] end |