Class: MailsocioQA::TestHtmlPage
- Inherits:
-
Object
- Object
- MailsocioQA::TestHtmlPage
- Defined in:
- lib/mailsocio_qa/test_html_page.rb
Instance Method Summary collapse
- #click ⇒ Object
-
#initialize(html) ⇒ TestHtmlPage
constructor
A new instance of TestHtmlPage.
- #load ⇒ Object
Constructor Details
#initialize(html) ⇒ TestHtmlPage
Returns a new instance of TestHtmlPage.
3 4 5 |
# File 'lib/mailsocio_qa/test_html_page.rb', line 3 def initialize(html) @doc = Nokogiri::HTML(html) end |
Instance Method Details
#click ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/mailsocio_qa/test_html_page.rb', line 13 def click @doc.css('a').each do |a| response = HTTPI.get(a['href']) raise "Expected redirect but got #{response.code}" unless response.code == 302 return response.headers['location'] end end |
#load ⇒ Object
7 8 9 10 11 |
# File 'lib/mailsocio_qa/test_html_page.rb', line 7 def load @doc.css('img').each do |img| open(img['src']) end end |