Class: Dommy::Rails::RSpec::Matchers::HaveSelect
- Inherits:
-
Object
- Object
- Dommy::Rails::RSpec::Matchers::HaveSelect
- Defined in:
- lib/dommy/rails/rspec/matchers.rb
Instance Method Summary collapse
- #description ⇒ Object
- #does_not_match?(actual) ⇒ Boolean
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(name, label:, count:) ⇒ HaveSelect
constructor
A new instance of HaveSelect.
- #matches?(actual) ⇒ Boolean
Constructor Details
#initialize(name, label:, count:) ⇒ HaveSelect
Returns a new instance of HaveSelect.
391 392 393 394 395 |
# File 'lib/dommy/rails/rspec/matchers.rb', line 391 def initialize(name, label:, count:) @name = name @label = label @count = count end |
Instance Method Details
#description ⇒ Object
406 407 408 |
# File 'lib/dommy/rails/rspec/matchers.rb', line 406 def description "have select" end |
#does_not_match?(actual) ⇒ Boolean
402 403 404 |
# File 'lib/dommy/rails/rspec/matchers.rb', line 402 def does_not_match?(actual) !matches?(actual) end |
#failure_message ⇒ Object
410 411 412 |
# File 'lib/dommy/rails/rspec/matchers.rb', line 410 def "expected to find select, found #{@matched.size}" end |
#failure_message_when_negated ⇒ Object
414 415 416 |
# File 'lib/dommy/rails/rspec/matchers.rb', line 414 def "expected not to find select, found #{@matched.size}" end |
#matches?(actual) ⇒ Boolean
397 398 399 400 |
# File 'lib/dommy/rails/rspec/matchers.rb', line 397 def matches?(actual) @matched = Dommy::Rails::PageInspector.selects(MatchTarget.document(actual), name: @name, label: @label) Dommy::Internal::DomMatching.count_matches?(@matched.size, @count) end |