Guest User

Untitled

a guest
Feb 20th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. require 'nokogiri'
  2. require 'test/unit'
  3.  
  4. class AssertSelectorTest < Test::Unit::TestCase
  5. def setup
  6. @doc = Nokogiri::HTML(<<-eohtml)
  7. <html>
  8. <body>
  9. <p>Hello world!</p>
  10. </body>
  11. </html>
  12. eohtml
  13. end
  14.  
  15. def test_make_sure_that_have_selector_works
  16. have_selector('p', @doc)
  17. end
  18.  
  19. def have_selector expected_selector, document, msg = nil
  20. assert document.css(expected_selector).length > 0, msg
  21. end
  22. end
Add Comment
Please, Sign In to add comment