class RSpec::Core::ExampleGroup

Public Instance Methods

described_method() click to toggle source
# File lib/rspec/unit_ext/core_ext/rspec/core/example_group/metadata.rb, line 8
def described_method
  metadata = self.class.metadata
  return metadata[:described_method] if metadata[:described_method]

  klass = described_class
  return nil unless klass.is_a? Class

  recurse_metadata do |cur|
    method = cur[:description].strip.gsub(%r{[^0-9A-Za-z_!?=+\-/*<>]}, '')
    if klass.respond_to?(method) || klass.method_defined?(method)
      metadata[:described_method] = method.to_sym
      false
    else
      true
    end
  end

  metadata[:described_method]
end
run_expectations(*expectations) click to toggle source
# File lib/rspec/unit_ext/core_ext/rspec/core/example_group/unit.rb, line 9
def run_expectations(*expectations)
  UnitExt::ExpectationGroup.new(self, *expectations).run
end

Private Instance Methods

recurse_metadata(&block) click to toggle source
# File lib/rspec/unit_ext/core_ext/rspec/core/example_group/metadata.rb, line 30
def recurse_metadata(&block)
  metadata = self.class.metadata
  metadata = metadata[:parent_example_group] while metadata && block.call(metadata)
end