Module: OnlyofficeTcmHelper::PendingHelper

Included in:
TcmHelper
Defined in:
lib/onlyoffice_tcm_helper/helpers/pending_helper.rb

Overview

module with methods for parsing test results

Instance Method Summary collapse

Instance Method Details

#handle_pending(example) ⇒ Symbol

Handle pending information

Parameters:

  • example (RSpec::Core::Example)

    to handle

Returns:

  • (Symbol)

    status of pending



35
36
37
38
39
40
# File 'lib/onlyoffice_tcm_helper/helpers/pending_helper.rb', line 35

def handle_pending(example)
  @comment = example.execution_result.pending_message
  exception = example.exception.to_s

  pending_status(exception)
end

#passed_pending_messageString

Returns Message if pending passed.

Returns:

  • (String)

    Message if pending passed



7
8
9
# File 'lib/onlyoffice_tcm_helper/helpers/pending_helper.rb', line 7

def passed_pending_message
  'Expected example to fail since it is pending, but it passed'
end

#pending_passed?(exception) ⇒ Boolean

Check if pending example passed This situation is incorrect - if pending is passing for some reason This pending comment should be removed and investigate

Parameters:

  • exception (String)

    text of example

Returns:

  • (Boolean)


16
17
18
# File 'lib/onlyoffice_tcm_helper/helpers/pending_helper.rb', line 16

def pending_passed?(exception)
  exception.start_with?(passed_pending_message)
end

#pending_status(exception) ⇒ Symbol

Get pending status by it’s comment

Parameters:

  • exception (String)

    text of example

Returns:

  • (Symbol)

    ‘:failed` or `:pending`



23
24
25
26
27
28
29
30
# File 'lib/onlyoffice_tcm_helper/helpers/pending_helper.rb', line 23

def pending_status(exception)
  if pending_passed?(exception)
    @comment = "#{passed_pending_message}\nOriginal Pending:\n#{@comment}"
    :failed
  else
    :pending
  end
end