Module: CucumberCinema

Defined in:
lib/cucumber-cinema.rb,
lib/cucumber_cinema/camera.rb,
lib/cucumber_cinema/view_strategy.rb

Defined Under Namespace

Modules: ViewSelectStrategy Classes: Camera

Instance Method Summary collapse

Instance Method Details

#screenshot_emails(options) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/cucumber-cinema.rb', line 6

def screenshot_emails(options)
  if ENV['CUCUMBER_CINEMA']
    current_emails = ActionMailer::Base.deliveries.uniq { |x| x.subject }
    new_emails = current_emails.select { |k, v| !$cucumber_cinema_emails.key?(k.subject) }
    new_emails.each { |k, v| $cucumber_cinema_emails[k.subject]=v }
    new_emails.each_with_index do |e, i|
      CucumberCinema::Camera.new(options).take_screenshot("<h1>#{e.subject}</h1><pre>#{e}</pre><hr />")
    end
  end
end