Sha256: 10d2879f7fb49703339502412718f828fa6938d825e27b612331fd50119e7339

Contents?: true

Size: 1.59 KB

Versions: 22

Compression:

Stored size: 1.59 KB

Contents

require 'percy'
require 'percy/capybara/version'
require 'percy/capybara/httpfetcher'
require 'percy/capybara/client'

module Percy
  module Capybara
    # @see Percy::Capybara::Client
    def self.capybara_client
      @capybara_client ||= Percy::Capybara::Client.new
    end

    # {include:Percy::Capybara::Client::Snapshots#snapshot}
    # @param (see Percy::Capybara::Client::Snapshots#snapshot)
    # @option (see Percy::Capybara::Client::Snapshots#snapshot)
    # @see Percy::Capybara::Client::Snapshots#snapshot
    def self.snapshot(page, options = {})
      capybara_client.snapshot(page, options)
    end

    # Creates a new build.
    #
    # This usually does not need to be called explictly because the build is automatically created
    # the first time a snapshot is created. However, this method might be useful in situations like
    # multi-process tests where a single build must be created before forking.
    #
    # @see Percy::Capybara::Client::Builds#initialize_build
    def self.initialize_build(options = {})
      capybara_client.initialize_build(options)
    end

    # Finalize the current build.
    #
    # This must be called to indicate that the build is complete after all snapshots have been
    # taken. It will silently return if no build or snapshots were created.
    #
    # @see Percy::Capybara::Client::Builds#finalize_current_build
    def self.finalize_build
      return if !capybara_client.build_initialized?
      capybara_client.finalize_current_build
    end

    # Reset the global Percy::Capybara module state.
    def self.reset
      @capybara_client = nil
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
percy-capybara-2.0.1 lib/percy/capybara.rb
percy-capybara-2.0.0 lib/percy/capybara.rb
percy-capybara-1.2.0 lib/percy/capybara.rb
percy-capybara-1.1.0 lib/percy/capybara.rb
percy-capybara-1.0.0 lib/percy/capybara.rb
percy-capybara-0.7.0 lib/percy/capybara.rb
percy-capybara-0.6.1 lib/percy/capybara.rb
percy-capybara-0.6.0 lib/percy/capybara.rb
percy-capybara-0.5.0 lib/percy/capybara.rb
percy-capybara-0.4.12 lib/percy/capybara.rb
percy-capybara-0.4.11 lib/percy/capybara.rb
percy-capybara-0.4.10 lib/percy/capybara.rb
percy-capybara-0.4.9 lib/percy/capybara.rb
percy-capybara-0.4.8 lib/percy/capybara.rb
percy-capybara-0.4.7 lib/percy/capybara.rb
percy-capybara-0.4.6 lib/percy/capybara.rb
percy-capybara-0.4.5 lib/percy/capybara.rb
percy-capybara-0.4.4 lib/percy/capybara.rb
percy-capybara-0.4.3 lib/percy/capybara.rb
percy-capybara-0.4.2 lib/percy/capybara.rb