Module: RSpecHTML::Matchers
- Extended by:
- RSpec::Matchers::DSL, RSpec::Matchers::DSL::Macros
- Defined in:
- lib/rspec_html/matchers.rb,
lib/rspec_html/matchers/base.rb,
lib/rspec_html/matchers/match_text.rb,
lib/rspec_html/matchers/contain_tag.rb
Overview
Provides matchers for identifying elements and text within a DOM element.
Defined Under Namespace
Modules: Base Classes: ContainTag, MatchText
Class Method Summary collapse
-
.define_matcher(name, class_) ⇒ Object
rubocop:disable Metrics/MethodLength.
Class Method Details
.define_matcher(name, class_) ⇒ Object
rubocop:disable Metrics/MethodLength
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/rspec_html/matchers.rb', line 14 def self.define_matcher(name, class_) matcher name do |expected, | rspec_html_matcher = class_.new(expected, || {}) match do |actual| rspec_html_matcher .save_actual(actual) .match(actual, expected_count: @expected_count, expected_count_type: @expected_count_type) .tap { @actual = rspec_html_matcher.rspec_actual } end description { rspec_html_matcher.description } include Countable { rspec_html_matcher. } diffable if class_.diffable? end end |