module Capybara::Screenshot::RSpec::HtmlLinkReporter
Public Instance Methods
attributes_for_screenshot_link(url)
click to toggle source
# File lib/capybara-screenshot/rspec/html_link_reporter.rb, line 31 def attributes_for_screenshot_link(url) {"href" => url, "style" => "margin-right: 10px; font-weight: bold"} end
extra_failure_content_with_screenshot(exception)
click to toggle source
# File lib/capybara-screenshot/rspec/html_link_reporter.rb, line 12 def extra_failure_content_with_screenshot(exception) result = extra_failure_content_without_screenshot(exception) example = @failed_examples.last if (screenshot = example.metadata[:screenshot]) result << "<p>Saved files: " result << link_to_screenshot("HTML page", screenshot[:html]) if screenshot[:html] result << link_to_screenshot("Screenshot", screenshot[:image]) if screenshot[:image] result << "</p>" end result end
link_to_screenshot(title, path)
click to toggle source
# File lib/capybara-screenshot/rspec/html_link_reporter.rb, line 24 def link_to_screenshot(title, path) url = URI.escape("file://#{path}") title = CGI.escape_html(title) attributes = attributes_for_screenshot_link(url).map { |name, val| %{#{name}="#{CGI.escape_html(val)}"} }.join(" ") "<a #{attributes}>#{title}</a>" end