Module: RSpec::HTML

Defined in:
lib/rspec/html.rb,
lib/rspec/html/version.rb

Overview

Module extension for RSpec::SharedContext

Constant Summary collapse

VERSION =
'0.3.5'

Instance Method Summary collapse

Instance Method Details

#documentObject



11
12
13
14
15
# File 'lib/rspec/html.rb', line 11

def document
  RSpecHTML::Element.new(Nokogiri::HTML.parse(response.body), :document)
rescue NameError
  raise RSpecHTML::NoResponseError, 'No `response` object found. Make a request first.'
end

#parse_html(content) ⇒ Object



17
18
19
# File 'lib/rspec/html.rb', line 17

def parse_html(content)
  RSpecHTML::Element.new(Nokogiri::HTML.parse(content), :document)
end