class Selenium::WebDriver::Support::Guards::Guard

Guard derived from RSpec example metadata. @api private

Attributes

guarded[R]
messages[R]
reason[R]
type[R]

Public Class Methods

new(guarded, type, guards = nil) click to toggle source
# File lib/selenium/webdriver/support/guards/guard.rb, line 34
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.delete(:reason)
end

Public Instance Methods

except?() click to toggle source

Bug is present on all configurations specified

# File lib/selenium/webdriver/support/guards/guard.rb, line 67
def except?
  @type == :except
end
exclude?() click to toggle source

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

# File lib/selenium/webdriver/support/guards/guard.rb, line 77
def exclude?
  @type == :exclude
end
exclusive?() click to toggle source

Test only applies to configurations specified

# File lib/selenium/webdriver/support/guards/guard.rb, line 82
def exclusive?
  @type == :exclusive
end
message() click to toggle source
# File lib/selenium/webdriver/support/guards/guard.rb, line 44
def message
  details = case @reason
            when Integer
              "Bug Filed: #{@tracker}/#{@reason}"
            when Symbol
              @messages[@reason]
            when String
              @reason
            else
              'no reason given'
            end

  case @type
  when :exclude
    "Test not guarded because it breaks test run; #{details}"
  when :exclusive
    "Test does not apply to this configuration; #{details}"
  else
    "Test guarded; #{details}"
  end
end
only?() click to toggle source

Bug is present on all configurations not specified

# File lib/selenium/webdriver/support/guards/guard.rb, line 72
def only?
  @type == :only
end