Module: RSpec::Core::Metadata::GroupMetadataHash

Includes:
MetadataHash
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

- (Object) container_stack



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

- (Object) described_class



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

- (Object) full_description



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