Skip to content

Commit

Permalink
Fix kucaahbe#62: use Nokogiri::HTML::DocumentFragment for parent_scope
Browse files Browse the repository at this point in the history
  • Loading branch information
benj committed Sep 12, 2020
1 parent 596a871 commit 306b8f4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rspec-html-matchers/have_tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def matches? src, &block

case src
when String
parent_scope = Nokogiri::HTML(src)
parent_scope = Nokogiri::HTML::DocumentFragment.parse(src)
@document = src
else
parent_scope = src.current_scope
Expand Down
16 changes: 16 additions & 0 deletions spec/issues_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# encoding: utf-8
# frozen_string_literal: true

require 'spec_helper'

describe 'working on github issues' do
describe '#62' do # https://github.com/kucaahbe/rspec-html-matchers/issues/62
it 'should not have html tag' do
expect('<p>My paragraph.</p>').not_to have_tag('html')
end

it 'should not have body tag' do
expect('<p>My paragraph.</p>').not_to have_tag('body')
end
end
end

0 comments on commit 306b8f4

Please sign in to comment.