Module: Capybara::RSpecMatchers::Matchers::Compound::Synchronizer Private

Included in:
And, Or
Defined in:
lib/capybara/rspec/matchers/compound.rb

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

Instance Method Summary collapse

Instance Method Details

#match(_expected, actual) ⇒ Object

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.



39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/capybara/rspec/matchers/compound.rb', line 39

def match(_expected, actual)
  @evaluator = CapybaraEvaluator.new(actual)
  syncer = sync_element(actual)
  begin
    syncer.synchronize do
      @evaluator.reset
      raise ::Capybara::ElementNotFound unless synchronized_match?

      true
    end
  rescue StandardError
    false
  end
end

#sync_element(el) ⇒ Object

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.



54
55
56
57
58
59
60
61
62
# File 'lib/capybara/rspec/matchers/compound.rb', line 54

def sync_element(el)
  if el.respond_to? :synchronize
    el
  elsif el.respond_to? :current_scope
    el.current_scope
  else
    Capybara.string(el)
  end
end