Module: Capybara::Screenshot::RSpec::BaseReporter

Included in:
HtmlEmbedReporter, HtmlLinkReporter, JsonReporter, TextMateLinkReporter, TextReporter
Defined in:
lib/capybara-screenshot/rspec/base_reporter.rb

Instance Method Summary collapse

Instance Method Details

#enhance_with_screenshot(method) ⇒ Object

Automatically set up method aliases (very much like ActiveSupport’s ‘alias_method_chain`) when the module gets included.



8
9
10
11
12
13
14
15
16
# File 'lib/capybara-screenshot/rspec/base_reporter.rb', line 8

def enhance_with_screenshot(method)
  with_method, without_method = "#{method}_with_screenshot", "#{method}_without_screenshot"
  define_singleton_method :included do |mod|
    if mod.method_defined?(method) || mod.private_method_defined?(method)
      mod.send :alias_method, without_method, method
      mod.send :alias_method, method, with_method
    end
  end
end