Class: Katalyst::Kpop::Matchers::CapybaraMatcher Private

Inherits:
Base
  • Object
show all
Defined in:
lib/katalyst/kpop/matchers/capybara_matcher.rb

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.

Direct Known Subclasses

FrameMatcher, ModalMatcher, StreamMatcher, TitleFinder

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#matchedObject (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.



8
9
10
# File 'lib/katalyst/kpop/matchers/capybara_matcher.rb', line 8

def matched
  @matched
end

Instance Method Details

#describe_actualObject

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.



28
29
30
31
32
# File 'lib/katalyst/kpop/matchers/capybara_matcher.rb', line 28

def describe_actual
  response = actual.native.children.to_html.gsub(/\s+/, " ")
  response = "#{response[0..120]}..." if response.length > 120
  response.inspect
end

#describe_expectedObject

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.



24
25
26
# File 'lib/katalyst/kpop/matchers/capybara_matcher.rb', line 24

def describe_expected
  expected.inspect
end

#descriptionObject

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.



20
21
22
# File 'lib/katalyst/kpop/matchers/capybara_matcher.rb', line 20

def description
  "match #{expected}"
end

#failure_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.



34
35
36
# File 'lib/katalyst/kpop/matchers/capybara_matcher.rb', line 34

def failure_message
  "expected #{describe_expected} but received #{describe_actual} instead"
end

#failure_message_when_negatedObject

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.



38
39
40
# File 'lib/katalyst/kpop/matchers/capybara_matcher.rb', line 38

def failure_message_when_negated
  "expected not to find #{expected}"
end

#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.



16
17
18
# File 'lib/katalyst/kpop/matchers/capybara_matcher.rb', line 16

def match(expected, actual)
  actual.find(expected)
end

#matches?(actual) ⇒ 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.

Returns:

  • (Boolean)


10
11
12
13
14
# File 'lib/katalyst/kpop/matchers/capybara_matcher.rb', line 10

def matches?(actual)
  super
rescue ::Capybara::ElementNotFound
  nil
end