class RSpecHtmlMatchers::NokogiriTextHelper

@api @private

Constants

NON_BREAKING_SPACE

Public Class Methods

new(text, squeeze_text = false) click to toggle source
# File lib/rspec-html-matchers/nokogiri_text_helper.rb, line 10
def initialize text, squeeze_text = false
  @text = text
  @squeeze_text = squeeze_text
end

Public Instance Methods

content(node_set) click to toggle source
# File lib/rspec-html-matchers/nokogiri_text_helper.rb, line 15
def content node_set
  node_set.find_all do |node|
    actual_content = node.content.gsub(NON_BREAKING_SPACE, ' ')
    actual_content = node.content.gsub(/\s+/, ' ').strip if @squeeze_text

    actual_content == @text
  end
end