Module: RSpec::Core::Metadata::GroupMetadataHash
- Defined in:
- lib/rspec/core/metadata.rb
Overview
Mixed in to Metadata for an ExampleGroup (extends MetadataHash) to support lazy evaluation of some values.
Instance Method Summary collapse
Instance Method Details
#container_stack ⇒ Object
151 152 153 154 155 156 157 158 159 160 |
# File 'lib/rspec/core/metadata.rb', line 151 def container_stack @container_stack ||= begin groups = [group = self] while group.has_key?(:example_group) groups << group[:example_group] group = group[:example_group] end groups end end |
#described_class ⇒ Object
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/rspec/core/metadata.rb', line 129 def described_class container_stack.each do |g| [:described_class, :describes].each do |key| if g.has_key?(key) value = g[key] return value unless value.nil? end end end container_stack.reverse.each do |g| candidate = g[:description_args].first return candidate unless String === candidate || Symbol === candidate end nil end |
#full_description ⇒ Object
147 148 149 |
# File 'lib/rspec/core/metadata.rb', line 147 def full_description build_description_from(*container_stack.reverse.map {|a| a[:description_args]}.flatten) end |