Exception: Cucumber::Core::Test::Result::Raisable

Inherits:
StandardError
  • Object
show all
Defined in:
lib/cucumber/core/test/result.rb

Overview

Base class for exceptions that can be raised in a step definition causing the step to have that result.

Direct Known Subclasses

Pending, Skipped, Undefined

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = '', duration = UnknownDuration.new, backtrace = nil) ⇒ Raisable

Returns a new instance of Raisable.



174
175
176
177
178
179
# File 'lib/cucumber/core/test/result.rb', line 174

def initialize(message = '', duration = UnknownDuration.new, backtrace = nil)
  @message = message
  @duration = duration
  super(message)
  set_backtrace(backtrace) if backtrace
end

Instance Attribute Details

#durationObject (readonly)

Returns the value of attribute duration.



172
173
174
# File 'lib/cucumber/core/test/result.rb', line 172

def duration
  @duration
end

#messageObject (readonly)

Returns the value of attribute message.



172
173
174
# File 'lib/cucumber/core/test/result.rb', line 172

def message
  @message
end

Instance Method Details

#ok?(strict: StrictConfiguration.new) ⇒ Boolean

Returns:

  • (Boolean)


203
204
205
# File 'lib/cucumber/core/test/result.rb', line 203

def ok?(strict: StrictConfiguration.new)
  self.class.ok?(strict: strict.strict?(to_sym))
end

#with_appended_backtrace(step) ⇒ Object



189
190
191
192
193
194
195
# File 'lib/cucumber/core/test/result.rb', line 189

def with_appended_backtrace(step)
  return self unless step.respond_to?(:backtrace_line)

  set_backtrace([]) unless backtrace
  backtrace << step.backtrace_line
  self
end

#with_duration(new_duration) ⇒ Object



185
186
187
# File 'lib/cucumber/core/test/result.rb', line 185

def with_duration(new_duration)
  self.class.new(message, new_duration, backtrace)
end

#with_filtered_backtrace(filter) ⇒ Object



197
198
199
200
201
# File 'lib/cucumber/core/test/result.rb', line 197

def with_filtered_backtrace(filter)
  return self unless backtrace

  filter.new(dup).exception
end

#with_message(new_message) ⇒ Object



181
182
183
# File 'lib/cucumber/core/test/result.rb', line 181

def with_message(new_message)
  self.class.new(new_message, duration, backtrace)
end