Sha256: c7fd8b0ac1244f3570623eb83b32f06bc211b063d5dd3fb197d3ee0f65763001
Contents?: true
Size: 671 Bytes
Versions: 12
Compression:
Stored size: 671 Bytes
Contents
# frozen_string_literal: true module RSpec module Support module Matchers module HTML def squish_html(str) str .gsub(/^[[:space:]]+/, "") .gsub(/>[[:space:]]+</m, "><") .strip end end end end end RSpec::Matchers.define :eq_html do |expected_html| include RSpec::Support::Matchers::HTML match do |actual_html| squish_html(actual_html) == squish_html(expected_html) end end RSpec::Matchers.define :include_html do |expected_html| include RSpec::Support::Matchers::HTML match do |actual_html| squish_html(actual_html).include?(squish_html(expected_html)) end end
Version data entries
12 entries across 12 versions & 1 rubygems