class Cucumber::Tree::BaseStep
def self.new_id!
def self.new_id! @next_id ||= -1 @next_id += 1 end
def actual_keyword
def actual_keyword keyword == Cucumber.language['and'] ? previous_step.actual_keyword : keyword end
def execute_in(world, regexp, args, proc)
def execute_in(world, regexp, args, proc) strip_pos = nil begin proc.call_in(world, *args) rescue ArityMismatchError => e e.backtrace[0] = proc.to_backtrace_line strip_pos = e.backtrace.index("#{__FILE__}:#{__LINE__ - 3}:in `execute_in'") format_error(strip_pos, proc, e) rescue => e method_line = "#{__FILE__}:#{__LINE__ - 6}:in `execute_in'" method_line_pos = e.backtrace.index(method_line) if method_line_pos strip_pos = method_line_pos - (Pending === e ? PENDING_ADJUSTMENT : REGULAR_ADJUSTMENT) else # This happens with rails, because they screw up the backtrace # before we get here (injecting erb stacktrace and such) end format_error(strip_pos, proc, e) end end
def file
def file @scenario.file end
def format_error(strip_pos, proc, e)
def format_error(strip_pos, proc, e) @error = e # Remove lines underneath the plain text step e.backtrace[strip_pos..-1] = nil unless strip_pos.nil? e.backtrace.flatten # Replace the step line with something more readable e.backtrace.replace(e.backtrace.map{|l| l.gsub(/`#{proc.meth}'/, "`#{keyword} #{proc.name}'")}) if row? e.backtrace << "#{file}:#{line}:in `#{proc.name}'" else e.backtrace << "#{file}:#{line}:in `#{keyword} #{name}'" end raise e end
def id
def id @id ||= self.class.new_id! end
def length
def length keyword.jlength + 1 + name.jlength end
def padding_length
def padding_length @scenario.step_padding_length(self) end
def previous_step
def previous_step @scenario.previous_step(self) end
def steps
def steps self end