class RegressyCommon::SnapShot

Public Class Methods

new(driver, tag) click to toggle source
# File lib/regressy_common/snap_shot.rb, line 4
def initialize(driver, tag)
  @driver = driver
  @tag = tag
end

Public Instance Methods

take_and_store() click to toggle source
# File lib/regressy_common/snap_shot.rb, line 9
def take_and_store
  save_screenshot
  RegressyCommon::SnapStorage.new.store_file(snap_file, @tag)
  true
end

Private Instance Methods

save_screenshot() click to toggle source
# File lib/regressy_common/snap_shot.rb, line 25
def save_screenshot
  @driver.save_screenshot(snap_file.path)
end
snap_file() click to toggle source
# File lib/regressy_common/snap_shot.rb, line 17
def snap_file
  @snap_file ||= Tempfile.create([snap_file_prefix, '.png'])
end
snap_file_prefix() click to toggle source
# File lib/regressy_common/snap_shot.rb, line 21
def snap_file_prefix
  (@tag.empty?)? "snap_" : %(snap_#{@tag}_)
end