Sha256: cada530d956f63b73f611637b8fafd530f8c6781059cef03043e408705a622be
Contents?: true
Size: 834 Bytes
Versions: 15
Compression:
Stored size: 834 Bytes
Contents
# rubocop:disable MethodName module Gurke module Steps def Given(step) rst = self.class.find_step(step, self, :given) send rst.method_name end def When(step) rst = self.class.find_step(step, self, :when) send rst.method_name end def Then(step) rst = self.class.find_step(step, self, :then) send rst.method_name end class << self 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 end end end
Version data entries
15 entries across 15 versions & 1 rubygems