Class/Module Index [+]

Quicksearch

RSpec::Core::Metadata::ExampleGroupHash

@private

Public Class Methods

backwards_compatibility_default_proc(&example_group_selector) click to toggle source
# File lib/rspec/core/metadata.rb, line 204
def self.backwards_compatibility_default_proc(&example_group_selector)
  Proc.new do |hash, key|
    case key
    when :example_group
      # We commonly get here when rspec-core is applying a previously configured
      # filter rule, such as when a gem configures:
      #
      #   RSpec.configure do |c|
      #     c.include MyGemHelpers, :example_group => { :file_path => /spec\/my_gem_specs/ }
      #   end
      #
      # It's confusing for a user to get a deprecation at this point in the code, so instead
      # we issue a deprecation from the config APIs that take a metadata hash, and MetadataFilter
      # sets this thread local to silence the warning here since it would be so confusing.
      unless RSpec.thread_local_metadata[:silence_metadata_example_group_deprecations]
        RSpec.deprecate("The `:example_group` key in an example group's metadata hash",
                        :replacement => "the example group's hash directly for the " +
                        "computed keys and `:parent_example_group` to access the parent " +
                        "example group metadata")
      end

      group_hash = example_group_selector.call(hash)
      LegacyExampleGroupHash.new(group_hash) if group_hash
    when :example_group_block
      RSpec.deprecate("`metadata[:example_group_block]`",
                      :replacement => "`metadata[:block]`")
      hash[:block]
    when :describes
      RSpec.deprecate("`metadata[:describes]`",
                      :replacement => "`metadata[:described_class]`")
      hash[:described_class]
    end
  end
end
create(parent_group_metadata, user_metadata, *args, &block) click to toggle source
# File lib/rspec/core/metadata.rb, line 187
def self.create(parent_group_metadata, user_metadata, *args, &block)
  group_metadata = hash_with_backwards_compatibility_default_proc

  if parent_group_metadata
    group_metadata.update(parent_group_metadata)
    group_metadata[:parent_example_group] = parent_group_metadata
  end

  hash = new(group_metadata, user_metadata, args, block)
  hash.populate
  hash.metadata
end
hash_with_backwards_compatibility_default_proc() click to toggle source
# File lib/rspec/core/metadata.rb, line 200
def self.hash_with_backwards_compatibility_default_proc
  Hash.new(&backwards_compatibility_default_proc { |hash| hash })
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.