Method: RSpecStepwise::ClassMethods#run_step

Defined in:
lib/two-step/stepwise.rb

#run_step(example, hook, &sorting) ⇒ Object



140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/two-step/stepwise.rb', line 140

def run_step(example, hook, &sorting)
  groups = if respond_to?(:parent_groups)
                    parent_groups
                  else
                    ancestors
                  end

  if block_given?
    groups = yield groups
  end

  RSpec::Core::Hooks::HookCollection.new(groups.map {|a| a.hooks[hook][:step]}.flatten.compact).for(example).run
end