Module: RSpec::Core::SharedExampleGroup
Relationships & Source Files | |
Namespace Children | |
Modules:
| |
Classes:
| |
Extension / Inclusion / Inheritance Descendants | |
Extended In:
| |
Defined in: | rspec-core/lib/rspec/core/shared_example_group.rb |
Overview
Shared example groups let you define common context and/or common examples that you wish to use in multiple example groups.
When defined, the shared group block is stored for later evaluation. It can later be included in an example group either explicitly (using include_examples
, include_context
or it_behaves_like
) or implicitly (via matching metadata).
Named shared example groups are scoped based on where they are defined. Shared groups defined in an example group are available for inclusion in that example group or any child example groups, but not in any parent or sibling example groups. Shared example groups defined at the top level can be included from any example group.
Instance Method Summary
-
#shared_context(name, *args, &block)
Alias for #shared_examples.
-
#shared_examples(name, &block)
(also: #shared_context, #shared_examples_for)
Stores the block for later use.
-
#shared_examples_for(name, *args, &block)
Alias for #shared_examples.