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.



167
168
169
170
171
172
173
174
# File 'lib/spinach/dsl.rb', line 167

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.



190
191
192
# File 'lib/spinach/dsl.rb', line 190

def name
  self.class.feature_name
end

- (Object) pending(reason)

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

Parameters:

  • reason (String)

    The reason why the step is set to pending

Raises:



204
205
206
# File 'lib/spinach/dsl.rb', line 204

def pending(reason)
  raise Spinach::StepPendingException.new(reason)
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.



183
184
185
186
# File 'lib/spinach/dsl.rb', line 183

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