Class: RSpec::Core::Metadata::ExampleGroupHash Private
Do not use. This class is for internal use only.
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
HashPopulator
|
|
Instance Chain:
self,
HashPopulator
|
|
Inherits: |
RSpec::Core::Metadata::HashPopulator
|
Defined in: | rspec-core/lib/rspec/core/metadata.rb |
Class Method Summary
- .backwards_compatibility_default_proc(&example_group_selector) Internal use only
- .create(parent_group_metadata, user_metadata, example_group_index, *args, &block) Internal use only
- .hash_with_backwards_compatibility_default_proc Internal use only
HashPopulator
- Inherited
Instance Attribute Summary
HashPopulator
- Inherited
Instance Method Summary
- #described_class private Internal use only
- #full_description private Internal use only
HashPopulator
- Inherited
Class Method Details
.backwards_compatibility_default_proc(&example_group_selector)
[ GitHub ]# File 'rspec-core/lib/rspec/core/metadata.rb', line 265
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::Support.thread_local_data[: ] 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, example_group_index, *args, &block)
[ GitHub ]# File 'rspec-core/lib/rspec/core/metadata.rb', line 248
def self.create(, , example_group_index, *args, &block) = hash_with_backwards_compatibility_default_proc if .update( ) [:parent_example_group] = end hash = new(, , example_group_index, args, block) hash.populate hash. end
.hash_with_backwards_compatibility_default_proc
[ GitHub ]# File 'rspec-core/lib/rspec/core/metadata.rb', line 261
def self.hash_with_backwards_compatibility_default_proc Hash.new(&backwards_compatibility_default_proc { |hash| hash }) end
Instance Method Details
#described_class (private)
[ GitHub ]# File 'rspec-core/lib/rspec/core/metadata.rb', line 304
def described_class candidate = [:description_args].first return candidate unless NilClass === candidate || String === candidate parent_group = [:parent_example_group] parent_group && parent_group[:described_class] end
#full_description (private)
[ GitHub ]# File 'rspec-core/lib/rspec/core/metadata.rb', line 311
def full_description description = [:description] parent_example_group = [:parent_example_group] return description unless parent_example_group parent_description = parent_example_group[:full_description] separator = description_separator(parent_example_group[:description_args].last, [:description_args].first) parent_description + separator + description end