Module: Spec::Ui::ScreenshotHelper

Included in:
WebappHelper
Defined in:
lib/spec/ui/screenshot_helper.rb

Instance Method Summary collapse

Instance Method Details

#md(dir) ⇒ Object



6
7
8
# File 'lib/spec/ui/screenshot_helper.rb', line 6

def md(dir)
  FileUtils.mkdir_p(dir) unless File.directory?(dir)
end

#save_screenshot(dir, spec_number) ⇒ Object



11
12
13
14
15
16
# File 'lib/spec/ui/screenshot_helper.rb', line 11

def save_screenshot(dir, spec_number)
  md(dir)
  img_path = "#{dir}/#{spec_number}.png"
  # How do we capture the current window??
  `screencapture #{img_path}`
end