-
-
Save andrewmp1/5979963 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# spec/support/poltergeist_screenshot_helper.rb | |
module PoltergeistScreenshotHelper | |
# FROM http://blog.jerodsanto.net/2012/12/capybara-and-poltergeist-snap/ | |
def snap!(options={}) | |
path = options.fetch :path, "~/.Trash" | |
file = options.fetch :file, "#{Time.now.to_i}.png" | |
full = options.fetch :full, true | |
path = File.expand_path path | |
path = "/tmp" if !File.exists?(path) | |
uri = File.join path, file | |
page.driver.render uri, full: full | |
system "open #{uri}" | |
end | |
end | |
RSpec.configure do |config| | |
config.include PoltergeistScreenshotHelper, :type => :request | |
config.include PoltergeistScreenshotHelper, :type => :feature | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment