class RSpec::Core::LegacyExampleGroupHash

  • Exposes the parent group metadata as ‘[:example_group]`.
    back to the top-level metadata hash.
    anonymous controller specs) such that changes are written<br>`metadata[:described_class]` when you use
    * Supports mutation (rspec-rails, for example, assigns
    under `:example_group`.
    * Exposes the top-level metadata keys that used to be nested
    `:example_group` to return an object that:
    Maintaining backwards compatibility was difficult: we wanted
    `:parent_example_group` returns the parent group’s metadata.
    exposed directly of the group metadata hash (no nesting), and
    In RSpec 3, we reorganized this to that the computed keys are
    keyed by ‘[:example_group]`.
    then the parent group’s metadata was exposed by sub-subhash
    were exposed from a nested subhash keyed by ‘[:example_group]`, and
    key. In RSpec 2.x, the computed keys of a group’s metadata
    provides backwards compatibility for the old ‘:example_group`
    Together with the example group metadata hash default block,
    @private

def directly_supports_attribute?(name)

def directly_supports_attribute?(name)
  name != :example_group
end

def get_value(name)

def get_value(name)
  @metadata[name]
end

def initialize(metadata)

def initialize(metadata)
  @metadata = metadata
  parent_group_metadata = metadata.fetch(:parent_example_group) { {} }[:example_group]
  self[:example_group] = parent_group_metadata if parent_group_metadata
end

def set_value(name, value)

def set_value(name, value)
  @metadata[name] = value
end

def to_h

def to_h
  super.merge(@metadata)
end