module CucumberCinema

Public Instance Methods

screenshot_emails(options) click to toggle source
# File lib/cucumber-cinema.rb, line 7
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