Class: Dommy::RSpec::Matchers::MatchDomHtml Private
- Inherits:
-
Object
- Object
- Dommy::RSpec::Matchers::MatchDomHtml
- 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
- #description ⇒ Object private
- #does_not_match?(scope) ⇒ Boolean private
- #failure_message ⇒ Object private
- #failure_message_when_negated ⇒ Object private
-
#initialize(expected_html) ⇒ MatchDomHtml
constructor
private
A new instance of MatchDomHtml.
- #matches?(scope) ⇒ Boolean private
Constructor Details
#initialize(expected_html) ⇒ MatchDomHtml
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 MatchDomHtml.
201 202 203 |
# File 'lib/dommy/rspec/matchers.rb', line 201 def initialize(expected_html) @expected_html = expected_html 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.
216 217 218 |
# File 'lib/dommy/rspec/matchers.rb', line 216 def description "match DOM HTML #{@expected_html.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.
212 213 214 |
# File 'lib/dommy/rspec/matchers.rb', line 212 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.
220 221 222 |
# File 'lib/dommy/rspec/matchers.rb', line 220 def "expected DOM HTML to match.\nExpected: #{@expected_normalized}\nActual: #{@actual_normalized}" 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.
224 225 226 |
# File 'lib/dommy/rspec/matchers.rb', line 224 def "expected DOM HTML NOT to match #{@expected_normalized}" 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.
205 206 207 208 209 210 |
# File 'lib/dommy/rspec/matchers.rb', line 205 def matches?(scope) @scope = Internal::ScopeResolution.resolve(scope) @actual_normalized = Internal::DomMatching.normalize_html(Internal::DomMatching.html_of(@scope)) @expected_normalized = Internal::DomMatching.normalize_html(@expected_html) @actual_normalized == @expected_normalized end |