123456789_123456789_123456789_123456789_123456789_

Class: Selenium::WebDriver::Support::Guards::Guard Private

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: rb/lib/selenium/webdriver/support/guards/guard.rb

Overview

Guard derived from RSpec example metadata.

Class Method Summary

Instance Attribute Summary

  • #except? ⇒ Boolean readonly Internal use only

    Bug is present on all configurations specified.

  • #exclude? ⇒ Boolean readonly Internal use only

    Bug is present on all configurations specified, but test can not be run because it breaks other tests, or it is flaky and unreliable.

  • #exclusive? ⇒ Boolean readonly Internal use only

    Test only applies to configurations specified.

  • #guarded readonly Internal use only
  • #messages readonly Internal use only
  • #only? ⇒ Boolean readonly Internal use only

    Bug is present on all configurations not specified.

  • #reason readonly Internal use only
  • #tracker readonly Internal use only
  • #type readonly Internal use only

Instance Method Summary

Constructor Details

.new(guarded, type, guards = nil) ⇒ Guard

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/support/guards/guard.rb', line 32

def initialize(guarded, type, guards = nil)
  @guarded = guarded
  @tracker = guards&.bug_tracker || ''
  @messages = guards&.messages || {}
  @messages[:unknown] = 'TODO: Investigate why this is failing and file a bug report'
  @type = type

  @reason = @guarded[:reason] || 'No reason given'
  @guarded[:reason] = @reason
end

Instance Attribute Details

#except?Boolean (readonly)

Bug is present on all configurations specified

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/support/guards/guard.rb', line 66

def except?
  @type == :except
end

#exclude?Boolean (readonly)

Bug is present on all configurations specified, but test can not be run because it breaks other tests, or it is flaky and unreliable

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/support/guards/guard.rb', line 77

def exclude?
  @type == :exclude || @type == :flaky
end

#exclusive?Boolean (readonly)

Test only applies to configurations specified

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/support/guards/guard.rb', line 82

def exclusive?
  @type == :exclusive
end

#guarded (readonly)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/support/guards/guard.rb', line 30

attr_reader :guarded, :type, :messages, :reason, :tracker

#messages (readonly)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/support/guards/guard.rb', line 30

attr_reader :guarded, :type, :messages, :reason, :tracker

#only?Boolean (readonly)

Bug is present on all configurations not specified

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/support/guards/guard.rb', line 71

def only?
  @type == :only
end

#reason (readonly)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/support/guards/guard.rb', line 30

attr_reader :guarded, :type, :messages, :reason, :tracker

#tracker (readonly)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/support/guards/guard.rb', line 30

attr_reader :guarded, :type, :messages, :reason, :tracker

#type (readonly)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/support/guards/guard.rb', line 30

attr_reader :guarded, :type, :messages, :reason, :tracker

Instance Method Details

#message

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/support/guards/guard.rb', line 43

def message
  details = case reason
            when Integer
              "Bug Filed: #{tracker}/#{reason}"
            when Symbol
              messages[reason]
            else
              "Guarded by #{guarded};"
            end

  case type
  when :exclude
    "Test skipped because it breaks test run; #{details}"
  when :flaky
    "Test skipped because it is unreliable in this configuration; #{details}"
  when :exclusive
    "Test does not apply to this configuration; #{details}"
  else
    "Test guarded; #{details}"
  end
end