Module: Capybara::Screenshot::RSpec::HtmlEmbedReporter

Extended by:
BaseReporter
Defined in:
lib/capybara-screenshot/rspec/html_embed_reporter.rb

Instance Method Summary collapse

Methods included from BaseReporter

enhance_with_screenshot

Instance Method Details

#extra_failure_content_with_screenshot(exception) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/capybara-screenshot/rspec/html_embed_reporter.rb', line 12

def extra_failure_content_with_screenshot(exception)
  result  = extra_failure_content_without_screenshot(exception)
  example = @failed_examples.last
  # Ignores saved html file, only saved image will be embedded (if present)
  if (screenshot = example.[:screenshot]) && screenshot[:image]
    result += "<img src='#{image_tag_source(screenshot[:image])}' style='display: block'>"
  end
  result
end