Sha256: b5f98d6a0892b421f479fadb88f63957aab9f8ee0251a785b30b67ce5045c799
Contents?: true
Size: 801 Bytes
Versions: 10
Compression:
Stored size: 801 Bytes
Contents
module Turnip module Execute def step(step_or_description, *extra_args) if step_or_description.respond_to?(:extra_args) description = step_or_description.description extra_args.concat(step_or_description.extra_args) else description = step_or_description end matches = methods.map do |method| next unless method.to_s.start_with?("match: ") send(method.to_s, description) end.compact if matches.length == 0 raise Turnip::Pending, description end if matches.length > 1 msg = ['Ambiguous step definitions'].concat(matches.map(&:trace)).join("\r\n") raise Turnip::Ambiguous, msg end send(matches.first.method_name, *(matches.first.params + extra_args)) end end end
Version data entries
10 entries across 10 versions & 1 rubygems