Class: MailsocioQA::TestHtmlPage

Inherits:
Object
  • Object
show all
Defined in:
lib/mailsocio_qa/test_html_page.rb

Instance Method Summary collapse

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

#clickObject



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

#loadObject



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