Class: Selenium::WebDriver::Support::Guards
- Inherits:
-
Object
- Object
- Selenium::WebDriver::Support::Guards
- Defined in:
- lib/selenium/webdriver/support/guards.rb,
lib/selenium/webdriver/support/guards/guard.rb,
lib/selenium/webdriver/support/guards/guard_condition.rb
Defined Under Namespace
Classes: Guard, GuardCondition
Constant Summary collapse
- GUARD_TYPES =
%i[except only exclude exclusive flaky].freeze
Instance Attribute Summary collapse
-
#bug_tracker ⇒ Object
Returns the value of attribute bug_tracker.
-
#messages ⇒ Object
readonly
Returns the value of attribute messages.
Instance Method Summary collapse
- #add_condition(name, condition = nil, &blk) ⇒ Object
- #add_message(name, message) ⇒ Object
- #disposition ⇒ Object
-
#initialize(example, bug_tracker: '', conditions: nil) ⇒ Guards
constructor
A new instance of Guards.
- #satisfied?(guard) ⇒ Boolean
Constructor Details
#initialize(example, bug_tracker: '', conditions: nil) ⇒ Guards
Returns a new instance of Guards.
32 33 34 35 36 37 38 |
# File 'lib/selenium/webdriver/support/guards.rb', line 32 def initialize(example, bug_tracker: '', conditions: nil) @example = example @bug_tracker = bug_tracker @guard_conditions = conditions || [] @guards = collect_example_guards @messages = {} end |
Instance Attribute Details
#bug_tracker ⇒ Object
Returns the value of attribute bug_tracker.
30 31 32 |
# File 'lib/selenium/webdriver/support/guards.rb', line 30 def bug_tracker @bug_tracker end |
#messages ⇒ Object (readonly)
Returns the value of attribute messages.
29 30 31 |
# File 'lib/selenium/webdriver/support/guards.rb', line 29 def @messages end |
Instance Method Details
#add_condition(name, condition = nil, &blk) ⇒ Object
40 41 42 |
# File 'lib/selenium/webdriver/support/guards.rb', line 40 def add_condition(name, condition = nil, &blk) @guard_conditions << GuardCondition.new(name, condition, &blk) end |
#add_message(name, message) ⇒ Object
44 45 46 |
# File 'lib/selenium/webdriver/support/guards.rb', line 44 def (name, ) @messages[name] = end |
#disposition ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/selenium/webdriver/support/guards.rb', line 48 def disposition if !skipping_guard.nil? [:skip, skipping_guard.] elsif !pending_guard.nil? && ENV.fetch('SKIP_PENDING', nil) [:skip, pending_guard.] elsif !pending_guard.nil? [:pending, pending_guard.] end end |
#satisfied?(guard) ⇒ Boolean
58 59 60 |
# File 'lib/selenium/webdriver/support/guards.rb', line 58 def satisfied?(guard) @guard_conditions.all? { |condition| condition.satisfied?(guard) } end |