Sha256: 72ca29580f1f3dfea10968de335468eb377564959dbba13b3fcd60857e303ca0
Contents?: true
Size: 782 Bytes
Versions: 1
Compression:
Stored size: 782 Bytes
Contents
require File.expand_path('../parser', __FILE__) class StepDefinition attr_accessor :kind, :step, :comment def self.new_from_raw(raw_step) raw_step =~ /^\s*(When|Then|Given|AfterStep)(.*)do/ kind, step = $1, $2 return unless step comment = Parser.format_comment(raw_step) return if comment =~ /\bnodoc\b/ new(kind, step, comment) end def initialize(kind, step, comment = nil) self.kind = kind self.step = step.strip self.comment = comment end def to_markdown <<-TEXT * **#{kind} #{pretty_step}** #{ comment.gsub /^/, ' ' } TEXT end def to_s "#{kind} #{pretty_step}" end private def pretty_step if kind == 'AfterStep' step[/@\w+/] else Parser.human_regex(step) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
spreewald-1.6.0 | support/step_definition.rb |