class Spec::Story::StepGroup

def self.steps(&block)

def self.steps(&block)
  @step_group ||= StepGroup.new(false)
  @step_group.instance_eval(&block) if block
  @step_group
end

def <<(other_step_matchers)

def <<(other_step_matchers)
  other_step_matchers.add_to(self) if other_step_matchers.respond_to?(:add_to)
end

def Given(name, &block)

def Given(name, &block)
  create_matcher(:given, name, &block)
end

def GivenScenario(name, &block)

def GivenScenario(name, &block)
  create_matcher(:given_scenario, name, &block)
end

def Then(name, &block)

def Then(name, &block)
  create_matcher(:then, name, &block)
end

def When(name, &block)

def When(name, &block)
  create_matcher(:when, name, &block)
end

def add(type, steps)

def add(type, steps)
  (@hash_of_lists_of_steps[type] << steps).flatten!
end

def add_to(other_step_matchers)

def add_to(other_step_matchers)
  [:given_scenario, :given, :when, :then].each do |type|
    other_step_matchers.add(type, @hash_of_lists_of_steps[type])
  end
end

def clear

def clear
  @hash_of_lists_of_steps.clear
end

def create_matcher(type, name, &block)

TODO - make me private
def create_matcher(type, name, &block)
  matcher = Step.new(name, &block)
  @hash_of_lists_of_steps[type] << matcher
  matcher
end

def empty?

def empty?
  [:given_scenario, :given, :when, :then].each do |type|
    return false unless @hash_of_lists_of_steps[type].empty?
  end
  return true
end

def find(type, name)

def find(type, name)
  @hash_of_lists_of_steps[type].each do |step|
    return step if step.matches?(name)
  end
  return nil
end

def initialize(init_defaults=true, &block)

def initialize(init_defaults=true, &block)
  @hash_of_lists_of_steps = Hash.new {|h, k| h[k] = []}
  if init_defaults
    self.class.steps.add_to(self)
  end
  instance_eval(&block) if block
end