Class: Cucumber::Undefined

Inherits:
Core::Test::Result::Undefined
  • Object
show all
Defined in:
lib/cucumber/errors.rb

Overview

Raised when there is no matching StepDefinition for a step.

Class Method Summary collapse

Class Method Details

.from(result, step_name) ⇒ Object


8
9
10
11
12
13
14
15
16
# File 'lib/cucumber/errors.rb', line 8

def self.from(result, step_name)
  return result.with_message(with_prefix(result.message)) if result.is_a?(self)

  begin
    raise new(with_prefix(step_name)) # rubocop:disable Style/RaiseArgs
  rescue StandardError => e
    return e
  end
end

.with_prefix(step_name) ⇒ Object


18
19
20
# File 'lib/cucumber/errors.rb', line 18

def self.with_prefix(step_name)
  %(Undefined step: "#{step_name}")
end