Sha256: 3e9f882c2b6e64fe8ec91513e2be1705937b6db705d17d6546e8df3572705141

Contents?: true

Size: 520 Bytes

Versions: 2

Compression:

Stored size: 520 Bytes

Contents

require 'tempfile'
require 'capybara'

module Gnawrnip
  class Screenshot
    class << self

      #
      # Screenshot of current capybara session
      #
      # @example
      #   image = Gnawrnip::Screenshot.take
      #
      # @return  [Tempfile]  Image of screenshot
      #
      def take
        tempfile = Tempfile.new(['gnawrnip', '.gif'])
        session.save_screenshot(tempfile.path)
        tempfile
      end

      private

      def session
        Capybara.current_session
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gnawrnip-0.0.3 lib/gnawrnip/screenshot.rb
gnawrnip-0.0.2 lib/gnawrnip/screenshot.rb