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

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/webdriver/support/guards/guard.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Guard derived from RSpec example metadata.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(guarded, type, guards = nil) ⇒ Guard

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Guard.



32
33
34
35
36
37
38
39
40
41
# File '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

#guardedObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



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

def guarded
  @guarded
end

#messagesObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



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

def messages
  @messages
end

#reasonObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



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

def reason
  @reason
end

#trackerObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



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

def tracker
  @tracker
end

#typeObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



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

def type
  @type
end

Instance Method Details

#except?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Test is expected to fail on the configurations specified (marked pending).

Returns:

  • (Boolean)


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

def except?
  @type == :pending_if || @type == :except
end

#exclude?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Test is skipped on the configurations specified because it breaks the run or is unreliable.

Returns:

  • (Boolean)


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

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

#exclusive?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Test is skipped on every configuration except those specified (it only applies there).

Returns:

  • (Boolean)


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

def exclusive?
  @type == :skip_unless || @type == :exclusive
end

#messageObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File '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 :skip_if, :exclude
    "Test skipped because it breaks test run; #{details}"
  when :flaky
    "Test skipped because it is unreliable in this configuration; #{details}"
  when :skip_unless, :exclusive
    "Test does not apply to this configuration; #{details}"
  else
    "Test guarded; #{details}"
  end
end

#only?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Test is expected to fail on every configuration except those specified (marked pending).

Returns:

  • (Boolean)


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

def only?
  @type == :pending_unless || @type == :only
end