Class: SpecForge::Error::InvalidStepError

Inherits:
Error
  • Object
show all
Defined in:
lib/spec_forge/error.rb

Overview

Raised when a step has an invalid configuration

Common cases:

  • Action attributes (request, expect, call, debug, store) combined with steps
  • Expects defined without a corresponding request

Instance Method Summary collapse

Constructor Details

#initialize(message, step = nil) ⇒ InvalidStepError

Returns a new instance of InvalidStepError.



249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
# File 'lib/spec_forge/error.rb', line 249

def initialize(message, step = nil)
  if step
    step_name = step[:name].presence || "(unnamed)"

    line_info = if (source = step[:source])
      "#{source[:file_name]}:#{source[:line_number]}"
    else
      "unknown location"
    end

    message = "Step #{step_name.in_quotes} [#{line_info}]: #{message}"
  end

  super(message)
end