Skip to content

Instantly share code, notes, and snippets.

@pedantix
Created August 15, 2014 18:36
Show Gist options
  • Save pedantix/47138869f93436de8dbf to your computer and use it in GitHub Desktop.
Save pedantix/47138869f93436de8dbf to your computer and use it in GitHub Desktop.
def show_me_a_screenshot
if Capybara.current_driver == :webkit
name = "screen-shot-#{Time.now.strftime('%Y-%m-%d-%H-%M-%S')}.png"
tmp_dir = File.join(Rails.root, 'tmp')
FileUtils.mkdir_p tmp_dir
file_name = File.join(tmp_dir, name)
page.driver.save_screenshot file_name
Launchy.open file_name
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment