Class: Dommy::RSpec::Matchers::ContainDom Private
- Inherits:
-
Object
- Object
- Dommy::RSpec::Matchers::ContainDom
- 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(selector, text: nil, count: nil) ⇒ ContainDom
constructor
private
A new instance of ContainDom.
- #matches?(scope) ⇒ Boolean private
Constructor Details
#initialize(selector, text: nil, count: nil) ⇒ ContainDom
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 ContainDom.
53 54 55 56 57 |
# File 'lib/dommy/rspec/matchers.rb', line 53 def initialize(selector, text: nil, count: nil) @selector = selector @text = text @count = count 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.
69 70 71 72 73 74 |
# File 'lib/dommy/rspec/matchers.rb', line 69 def description parts = ["contain DOM matching #{@selector.inspect}"] parts << "with text #{@text.inspect}" if @text parts << "(count: #{@count.inspect})" if @count parts.join(" ") 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.
65 66 67 |
# File 'lib/dommy/rspec/matchers.rb', line 65 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.
76 77 78 |
# File 'lib/dommy/rspec/matchers.rb', line 76 def "expected #{describe_scope} to #{description} (found #{@matched.size})" 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.
80 81 82 |
# File 'lib/dommy/rspec/matchers.rb', line 80 def "expected #{describe_scope} not to #{description} (found #{@matched.size})" 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.
59 60 61 62 63 |
# File 'lib/dommy/rspec/matchers.rb', line 59 def matches?(scope) @scope = Internal::ScopeResolution.resolve(scope) @matched = Internal::DomMatching.filter(@scope, @selector, text: @text) Internal::DomMatching.count_matches?(@matched.size, @count) end |