Class: Dommy::RSpec::CapyStyleMatchers::HaveContent Private
- Inherits:
-
Object
- Object
- Dommy::RSpec::CapyStyleMatchers::HaveContent
- Defined in:
- lib/dommy/rspec/capy_style_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.
Direct Known Subclasses
Instance Method Summary collapse
- #description ⇒ Object private
- #does_not_match?(scope) ⇒ Boolean private
- #failure_message ⇒ Object private
- #failure_message_when_negated ⇒ Object private
-
#initialize(text, **opts) ⇒ HaveContent
constructor
private
A new instance of HaveContent.
- #matches?(scope) ⇒ Boolean private
Constructor Details
#initialize(text, **opts) ⇒ HaveContent
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 HaveContent.
184 185 186 187 |
# File 'lib/dommy/rspec/capy_style_matchers.rb', line 184 def initialize(text, **opts) @text = text @exact = opts[:exact] || opts[:exact_text] end |
Instance Method Details
#description ⇒ 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.
199 200 201 |
# File 'lib/dommy/rspec/capy_style_matchers.rb', line 199 def description "have content #{@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.
195 196 197 |
# File 'lib/dommy/rspec/capy_style_matchers.rb', line 195 def does_not_match?(scope) !matches?(scope) end |
#failure_message ⇒ 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.
203 204 205 |
# File 'lib/dommy/rspec/capy_style_matchers.rb', line 203 def "expected text to include #{@text.inspect}, got #{@actual.inspect}" end |
#failure_message_when_negated ⇒ 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.
207 208 209 |
# File 'lib/dommy/rspec/capy_style_matchers.rb', line 207 def "expected text NOT to include #{@text.inspect}, got #{@actual.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.
189 190 191 192 193 |
# File 'lib/dommy/rspec/capy_style_matchers.rb', line 189 def matches?(scope) @scope = Internal::ScopeResolution.resolve(scope) @actual = Internal::DomMatching.text_of(@scope) Internal::DomMatching.text_matches?(@actual, @text, exact: @exact) end |