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.



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

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.



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

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.



26
27
28
# File 'lib/katalyst/kpop/matchers/capybara_matcher.rb', line 26

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.



22
23
24
# File 'lib/katalyst/kpop/matchers/capybara_matcher.rb', line 22

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.



36
37
38
# File 'lib/katalyst/kpop/matchers/capybara_matcher.rb', line 36

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.



40
41
42
# File 'lib/katalyst/kpop/matchers/capybara_matcher.rb', line 40

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.



18
19
20
# File 'lib/katalyst/kpop/matchers/capybara_matcher.rb', line 18

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)


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

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