diff --git a/lib/rspec-html-matchers/nokogiri_text_helper.rb b/lib/rspec-html-matchers/nokogiri_text_helper.rb index cfb622b..27eccfe 100644 --- a/lib/rspec-html-matchers/nokogiri_text_helper.rb +++ b/lib/rspec-html-matchers/nokogiri_text_helper.rb @@ -15,7 +15,7 @@ def initialize text, squeeze_text = false def content node_set node_set.find_all do |node| actual_content = node.content.gsub(NON_BREAKING_SPACE, ' ') - actual_content = node.content.strip.squeeze(' ') if @squeeze_text + actual_content = node.content.gsub(/\s+/, ' ').strip if @squeeze_text actual_content == @text end diff --git a/spec/issues_spec.rb b/spec/issues_spec.rb index b94cd12..f55a7c9 100644 --- a/spec/issues_spec.rb +++ b/spec/issues_spec.rb @@ -13,4 +13,15 @@ expect('

My paragraph.

').not_to have_tag('body') end end + + it '#73' do # https://github.com/kucaahbe/rspec-html-matchers/issues/73 + rendered = < + content with ignored + spaces + around +

+HTML + expect(rendered).to have_tag('p', :seen => 'content with ignored spaces around') + end end