not_to have_ancestor(:css, '#footer')
end
it 'drops illegal fragments when using gumbo' do
skip 'libxml is less strict than Gumbo' unless Nokogiri.respond_to?(:HTML5)
described_class.use_html5_parsing = true
expect(described_class.string('
1 | ')).not_to have_css('td')
end
it 'can disable use of HTML5 parsing' do
skip "Test doesn't make sense unlesss HTML5 parsing is loaded (Nokogumbo or Nokogiri >= 1.12.0)" unless Nokogiri.respond_to?(:HTML5)
described_class.use_html5_parsing = false
expect(described_class.string('1 | ')).to have_css('td')
end
describe '#title' do
it 'returns the page title' do
expect(string.title).to eq('simple_node')
end
end
describe '#has_title?' do
it 'returns whether the page has the given title' do
expect(string.has_title?('simple_node')).to be true
expect(string.has_title?('monkey')).to be false
end
it 'allows regexp matches' do
expect(string.has_title?(/s[a-z]+_node/)).to be true
expect(string.has_title?(/monkey/)).to be false
end
end
describe '#has_no_title?' do
it 'returns whether the page does not have the given title' do
expect(string.has_no_title?('simple_node')).to be false
expect(string.has_no_title?('monkey')).to be true
end
it 'allows regexp matches' do
expect(string.has_no_title?(/s[a-z]+_node/)).to be false
expect(string.has_no_title?(/monkey/)).to be true
end
end
end
end