Module: CucumberCinema::ViewSelectStrategy

Defined in:
lib/cucumber_cinema/view_strategy.rb

Class Method Summary collapse

Class Method Details

.new_movie(options = {}) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/cucumber_cinema/view_strategy.rb', line 15

def self.new_movie(options={})
  $cucumber_cinema_screenshots = {}
  $cucumber_cinema_dir_name = "#{Time.new.strftime("%Y%m%d%H%M%S")}"
  $cucumber_cinema_emails = {}
  $cucumber_cinema_location=options[:location] || "#{Rails.root}/tmp/screenshots/"
  $cucumber_cinema_prefix = options[:prefix].present? ? options[:prefix] : "take"
end

.take_screenshot?(request) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
7
8
9
10
11
12
13
# File 'lib/cucumber_cinema/view_strategy.rb', line 4

def self.take_screenshot?(request)
  return false unless request
  current_shot = "#{request.filtered_parameters["controller"]}-#{request.filtered_parameters["action"]}-#{request.method}"
  if !$cucumber_cinema_screenshots[current_shot]
    $cucumber_cinema_screenshots[current_shot] = 1
    true
  else
    false
  end
end