Module: TestBench::Session::Controls::Exception::Cause

Defined in:
lib/test_bench/session/controls/exception.rb

Constant Summary collapse

Example =
self.example

Class Method Summary collapse

Class Method Details

.example(exception_message: nil, exception_class: nil) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/test_bench/session/controls/exception.rb', line 46

def self.example(exception_message: nil, exception_class: nil)
  exception_message ||= self.exception_message
  exception_class ||= self.exception_class

  Raise.(exception_class, exception_message)
rescue SomeOtherException
  exception = Exception.example(exception_message:, exception_class:)
  return exception
else
  abort "Unreachable"
end

.exception_classObject



62
63
64
# File 'lib/test_bench/session/controls/exception.rb', line 62

def self.exception_class
  SomeOtherException
end

.exception_messageObject



58
59
60
# File 'lib/test_bench/session/controls/exception.rb', line 58

def self.exception_message
  "Some exception cause"
end