Module Capybara::Screenshot::RSpec
In: lib/capybara-screenshot/rspec/text_reporter.rb
lib/capybara-screenshot/rspec/html_embed_reporter.rb
lib/capybara-screenshot/rspec/html_link_reporter.rb
lib/capybara-screenshot/rspec/textmate_link_reporter.rb
lib/capybara-screenshot/rspec/base_reporter.rb
lib/capybara-screenshot/rspec/json_reporter.rb
lib/capybara-screenshot/rspec.rb

Methods

Classes and Modules

Module Capybara::Screenshot::RSpec::BaseReporter
Module Capybara::Screenshot::RSpec::HtmlEmbedReporter
Module Capybara::Screenshot::RSpec::HtmlLinkReporter
Module Capybara::Screenshot::RSpec::JsonReporter
Module Capybara::Screenshot::RSpec::TextMateLinkReporter
Module Capybara::Screenshot::RSpec::TextReporter

Constants

REPORTERS = { "RSpec::Core::Formatters::ProgressFormatter" => Capybara::Screenshot::RSpec::TextReporter, "RSpec::Core::Formatters::DocumentationFormatter" => Capybara::Screenshot::RSpec::TextReporter, "RSpec::Core::Formatters::HtmlFormatter" => Capybara::Screenshot::RSpec::HtmlLinkReporter, "RSpec::Core::Formatters::JsonFormatter" => Capybara::Screenshot::RSpec::JsonReporter, "RSpec::Core::Formatters::TextMateFormatter" => Capybara::Screenshot::RSpec::TextMateLinkReporter, # RSpec 2 "RSpec::Mate::Formatters::TextMateFormatter" => Capybara::Screenshot::RSpec::TextMateLinkReporter, # RSpec 3 "Fuubar" => Capybara::Screenshot::RSpec::TextReporter, "Spec::Runner::Formatter::TeamcityFormatter" => Capybara::Screenshot::RSpec::TextReporter   Reporters extend RSpec formatters to display information about screenshots for failed examples.

Technically, a reporter is a module that gets injected into a RSpec formatter class. It uses method aliasing to extend some (usually just one) of the formatter‘s methods.

Implementing a custom reporter is as simple as creating a module and setting up the appropriate aliases. Use `BaseReporter.enhance_with_screenshot` if you don‘t want to set up the aliases manually:

  module MyReporter
    extend Capybara::Screenshot::RSpec::BaseReporter

    # Will replace the formatter's original `dump_failure_info` method with
    # `dump_failure_info_with_screenshot` from this module:
    enhance_with_screenshot :dump_failure_info

    def dump_failure_info_with_screenshot(example)
      dump_failure_info_without_screenshot(example) # call original implementation
      ... # your additions here
    end
  end

Finally customize `Capybara::Screenshot::RSpec::FORMATTERS` to make sure your reporter gets injected into the appropriate formatter.

Attributes

add_link_to_screenshot_for_failed_examples  [RW] 

Public Class methods

[Validate]