class Lopata::ActionStep

@private Used for action, setup, teardown, verify

Public Instance Methods

convert_args(scenario) click to toggle source
# File lib/lopata/step.rb, line 56
def convert_args(scenario)
  flat_args = separate_args(args.flatten)
  flat_args.map do |arg|
    case arg
      # trait symbols as link to metadata.
      when Symbol then scenario.metadata[arg]
    else
      arg
    end
  end.flatten
end
execution_steps(scenario, groups: []) click to toggle source
# File lib/lopata/step.rb, line 35
def execution_steps(scenario, groups: [])
  steps = []
  return steps if condition && !condition.match?(scenario)
  convert_args(scenario).each do |step|
    if step.is_a?(String)
      Lopata::SharedStep.find(step).steps.each do |shared_step|
        next if shared_step.condition && !shared_step.condition.match?(scenario)
        steps += shared_step.execution_steps(scenario, groups: groups)
      end
    elsif step.is_a?(Proc)
      steps << StepExecution.new(self, groups, &step)
    end
  end
  steps << StepExecution.new(self, groups, &block) if block
  steps.reject { |s| !s.block }
end
separate_args(args) click to toggle source
# File lib/lopata/step.rb, line 52
def separate_args(args)
  args.map { |a| a.is_a?(String) && a =~ /,/ ? a.split(',').map(&:strip) : a }.flatten
end
title() click to toggle source
# File lib/lopata/step.rb, line 68
def title
  shared_step && "#{method_name.capitalize} #{shared_step.name}" || "Untitled #{method_name}"
end