Class: OnlyofficeTestrailWrapper::ExampleFailedGotExpectedException

Inherits:
Object
  • Object
show all
Defined in:
lib/onlyoffice_testrail_wrapper/testrail_helper/example_failed_got_expected_exception.rb

Overview

Class for exception then result contains ‘got` and `expected`

Instance Method Summary collapse

Constructor Details

#initialize(example) ⇒ ExampleFailedGotExpectedException

Returns a new instance of ExampleFailedGotExpectedException.



6
7
8
# File 'lib/onlyoffice_testrail_wrapper/testrail_helper/example_failed_got_expected_exception.rb', line 6

def initialize(example)
  @example = example
end

Instance Method Details

#commentString

Returns comment for this exception.

Returns:

  • (String)

    comment for this exception



16
17
18
19
20
21
22
23
24
# File 'lib/onlyoffice_testrail_wrapper/testrail_helper/example_failed_got_expected_exception.rb', line 16

def comment
  return @comment if @comment

  failed_line = RspecHelper.find_failed_line(@example)
  @comment = "\n#{@example.exception
                          .to_s
                          .gsub('got:', "got:\n")
                          .gsub('expected:', "expected:\n")}\nIn line:\n#{failed_line}"
end

#resultSymbol

Returns result of this exception.

Returns:

  • (Symbol)

    result of this exception



11
12
13
# File 'lib/onlyoffice_testrail_wrapper/testrail_helper/example_failed_got_expected_exception.rb', line 11

def result
  :failed
end