Class: Assert::Result::Fail

Inherits:
Base
  • Object
show all
Defined in:
lib/assert/result.rb,
lib/assert/result.rb

Class Method Summary collapse

Methods inherited from Base

#==, #backtrace, #file_line, #file_name, #initialize, #inspect, #line_num, #message, #name, #output, #set_backtrace, #set_with_bt, #src_line, #test_file_line, #test_file_name, #test_id, #test_line_num, #test_name, #to_s, #to_sym, #trace, #type, #with_bt_set?

Constructor Details

This class inherits a constructor from Assert::Result::Base

Class Method Details

.for_test(test, msg_or_err, bt = nil) ⇒ Object

fail results can be generated manually or by raising Assert::Result::TestFailure


226
227
228
229
230
231
232
233
234
235
236
237
238
239
# File 'lib/assert/result.rb', line 226

def self.for_test(test, msg_or_err, bt = nil)
  if msg_or_err.is_a?(TestFailure)
    super(test, msg_or_err.message, msg_or_err.backtrace).tap do |result|
      result.set_with_bt(msg_or_err.assert_with_bt)
    end
  elsif msg_or_err.is_a?(Exception)
    raise(
      ArgumentError,
      "generate fail results by raising Assert::Result::TestFailure",
    )
  else
    super(test, msg_or_err, bt)
  end
end

.nameObject


220
221
222
# File 'lib/assert/result.rb', line 220

def self.name
  "Fail"
end

.typeObject


216
217
218
# File 'lib/assert/result.rb', line 216

def self.type
  :fail
end