Skip to content

Instantly share code, notes, and snippets.

@arthurnn
Created July 29, 2015 11:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arthurnn/38edce7b345ec8ba74d4 to your computer and use it in GitHub Desktop.
Save arthurnn/38edce7b345ec8ba74d4 to your computer and use it in GitHub Desktop.
require 'minitest/autorun'
require 'nokogiri'
class NokoTest < MiniTest::Unit::TestCase
def test_css_select_without_noscript
s = <<-M
<p class="content">
<strong>Morning</strong>
Hi, I hope to see you soon...
</p>
M
node = Nokogiri::HTML(s).root
assert_equal s.strip, node.css('.content').to_s
end
def test_css_select_with_noscript
s = <<-M
<p class="content">
<strong>Morning</strong>
<noscript>foo</noscript>
Hi, I hope to see you soon...
</p>
M
node = Nokogiri::HTML(s).root
assert_equal s.strip, node.css('.content').to_s
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment