module Gurke::Steps

Public Class Methods

find_step(step, world, type) click to toggle source
# File lib/gurke/steps.rb, line 23
def find_step(step, world, type)
  matches = world.methods.map do |method|
    next unless method.to_s.start_with?('match: ')
    world.send(method.to_s, step.to_s, type)
  end.compact

  case matches.size
    when 0 then raise Gurke::StepPending.new step.to_s
    when 1 then matches.first
    else raise Gurke::StepAmbiguous.new step.to_s
  end
end

Public Instance Methods

Given(step) click to toggle source

rubocop:disable MethodName

# File lib/gurke/steps.rb, line 6
def Given(step)
  rst = self.class.find_step(step, self, :given)
  send rst.method_name
end
Then(step) click to toggle source
# File lib/gurke/steps.rb, line 16
def Then(step)
  rst = self.class.find_step(step, self, :then)
  send rst.method_name
end
When(step) click to toggle source
# File lib/gurke/steps.rb, line 11
def When(step)
  rst = self.class.find_step(step, self, :when)
  send rst.method_name
end