Sha256: 904cff8501bfcf1929a0e80ef145e2cf3d6c52d660525eb11fb57d113c3a6eb4
Contents?: true
Size: 703 Bytes
Versions: 1
Compression:
Stored size: 703 Bytes
Contents
module Turnip module Steps class Pending < StandardError; end class Ambiguous < StandardError; end extend self def execute_step(context, description) context.instance_eval(&find_step(description)) rescue Pending context.pending "the step '#{description}' is not implemented" end def add_step(description, &block) steps << [description, block] end def find_step(description) found = steps.select do |step| step.first == description end raise Pending, description if found.length == 0 raise Ambiguous, description if found.length > 1 found[0][1] end def steps @steps ||= [] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
turnip-0.1.0 | lib/turnip/steps.rb |