Class: RSpecHTML::Matchers::ContainTag

Inherits:
Object
  • Object
show all
Includes:
Countable, Base
Defined in:
lib/rspec_html/matchers/contain_tag.rb

Overview

Matches elements within a given DOM element.

Instance Attribute Summary

Attributes included from Base

#rspec_actual

Instance Method Summary collapse

Methods included from Countable

#at_least, #at_most, #once, #times, #twice

Methods included from Base

#description, #failure_message, included, #initialize, #pluralize, #reconstituted, #save_actual

Instance Method Details

#match(actual, expected_count:, expected_count_type:) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/rspec_html/matchers/contain_tag.rb', line 10

def match(actual, expected_count:, expected_count_type:)
  @actual = actual
  @expected_count = expected_count
  @expected_count_type = expected_count_type
  return actual.public_send(@expected, @options).present? if @expected_count.nil?

  @actual_count = actual.public_send(@expected, @options).size
  count_match?
end