Module: RSpec::Core::SharedContext
- Includes:
- Hooks, Let::ExampleGroupMethods
- Defined in:
- lib/rspec/core/shared_context.rb
Overview
Exposes [ExampleGroup](ExampleGroup)-level methods to a module, so you can include that module in an [ExampleGroup](ExampleGroup).
Instance Method Summary collapse
- #describe(name, *args, &block) ⇒ Object (also: #context)
- #included(group) ⇒ Object
Methods included from Let::ExampleGroupMethods
Methods included from Hooks
#after, #around, #before, #find_hook, #hooks, #run_hook, #run_hook!, #run_hook_filtered
Methods included from MetadataHashBuilder::Common
Instance Method Details
#describe(name, *args, &block) ⇒ Object Also known as: context
34 35 36 |
# File 'lib/rspec/core/shared_context.rb', line 34 def describe(name, *args, &block) _nested_group_declarations << [name, block, *args] end |
#included(group) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rspec/core/shared_context.rb', line 23 def included(group) [:before, :after].each do |type| [:all, :each].each do |scope| group.hooks[type][scope].concat hooks[type][scope] end end _nested_group_declarations.each do |name, block, *args| group.describe name, *args, &block end end |