Class: Dommy::RSpec::Matchers::ContainDomText Private

Inherits:
Object
  • Object
show all
Defined in:
lib/dommy/rspec/matchers.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.

Instance Method Summary collapse

Constructor Details

#initialize(text) ⇒ ContainDomText

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



93
94
95
# File 'lib/dommy/rspec/matchers.rb', line 93

def initialize(text)
  @text = text
end

Instance Method Details

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



107
108
109
# File 'lib/dommy/rspec/matchers.rb', line 107

def description
  "contain text #{@text.inspect}"
end

#does_not_match?(scope) ⇒ 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)


103
104
105
# File 'lib/dommy/rspec/matchers.rb', line 103

def does_not_match?(scope)
  !matches?(scope)
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.



111
112
113
# File 'lib/dommy/rspec/matchers.rb', line 111

def failure_message
  "expected text to include #{@text.inspect}, got #{@actual_text.inspect}"
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.



115
116
117
# File 'lib/dommy/rspec/matchers.rb', line 115

def failure_message_when_negated
  "expected text not to include #{@text.inspect}, got #{@actual_text.inspect}"
end

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


97
98
99
100
101
# File 'lib/dommy/rspec/matchers.rb', line 97

def matches?(scope)
  @scope = Internal::ScopeResolution.resolve(scope)
  @actual_text = Internal::DomMatching.text_of(@scope)
  Internal::DomMatching.text_matches?(@actual_text, @text)
end