module Spinach::DSL::InstanceMethods

Instance methods to include in the host class.

Public Instance Methods

execute(step) click to toggle source

Executes a given step.

@api public

# File lib/spinach/dsl.rb, line 178
def execute(step)
  underscored_step = Spinach::Support.underscore(step.name)
  if self.respond_to?(underscored_step)
    self.send(underscored_step)
  else
    raise Spinach::StepNotDefinedException.new(step)
  end
end
name() click to toggle source

@return [String]

The feature name.
# File lib/spinach/dsl.rb, line 201
def name
  self.class.feature_name
end
pending(reason) click to toggle source

Raises an exception that defines the current step as a pending one.

@api public

@param [String] reason

The reason why the step is set to pending

@raise [Spinach::StepPendingException]

Raising the exception tells the scenario runner the current step is
pending.
# File lib/spinach/dsl.rb, line 215
def pending(reason)
  raise Spinach::StepPendingException.new(reason)
end
step_location_for(step) click to toggle source

Gets current step source location.

@param [String] step

The step name to execute.

@return [String]

The file and line where the step was defined.
# File lib/spinach/dsl.rb, line 194
def step_location_for(step)
  underscored_step = Spinach::Support.underscore(step)
  location = method(underscored_step).source_location if self.respond_to?(underscored_step)
end