module RSpec::Core::SharedExampleGroup

def shared_examples(name, *args, &block)

Other tags:
    See: ExampleGroup.include_context -
    See: ExampleGroup.include_examples -
    See: ExampleGroup.it_behaves_like -

Parameters:
  • block () -- The block to be eval'd
  • metadata (Array, Hash) -- metadata to attach to this group; any example group
  • block () -- The block to be eval'd
  • metadata (Array, Hash) -- metadata to attach to this group; any example group
  • name (String, Symbol, Module) -- identifer to use when looking up this shared group
  • block () -- The block to be eval'd
  • name (String, Symbol, Module) -- identifer to use when looking up this shared group

Overloads:
  • shared_examples(metadata, &block)
  • shared_examples(name, metadata, &block)
  • shared_examples(name, &block)
def shared_examples(name, *args, &block)
  top_level = self == ExampleGroup
  if top_level && RSpec.thread_local_metadata[:in_example_group]
    raise "Creating isolated shared examples from within a context is " \
          "not allowed. Remove `RSpec.` prefix or move this to a " \
          "top-level scope."
  end
  RSpec.world.shared_example_group_registry.add(self, name, *args, &block)
end