Module: Spinach::DSL::InstanceMethods

Defined in:
lib/spinach/dsl.rb

Overview

Instance methods to include in the host class.

Instance Method Summary (collapse)

Instance Method Details

- (Object) execute(step)

Executes a given step.



84
85
86
87
88
89
90
91
# File 'lib/spinach/dsl.rb', line 84

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

- (String) name

The feature name.

Returns:

  • (String)

    The feature name.



107
108
109
# File 'lib/spinach/dsl.rb', line 107

def name
  self.class.feature_name
end

- (String) step_location_for(step)

Gets current step source location.

Parameters:

  • step (String)

    The step name to execute.

Returns:

  • (String)

    The file and line where the step was defined.



100
101
102
103
# File 'lib/spinach/dsl.rb', line 100

def step_location_for(step)
  underscored_step = Spinach::Support.underscore(step)
  location = method(underscored_step).source_location if self.respond_to?(underscored_step)
end