Sha256: 7d099f02b7dead54184ad61571e13a62d3c49f2ef2239f63c170caa1ae055a2d

Contents?: true

Size: 627 Bytes

Versions: 3

Compression:

Stored size: 627 Bytes

Contents

require 'sauce/utilities'
require 'sauce/job'
require 'sauce/client'
require 'sauce/config'
require 'sauce/selenium'
require 'sauce/integrations'
require 'sauce/connect'

module Sauce
  @@cached_sessions = {}

  def self.cached_session(opts)
    @@cached_sessions[opts] or new_session(opts)
  end

  private

  def self.new_session(opts)
    session = nil
    if Sauce::Config.new.local?
      session = ::Selenium::Client::Driver.new(opts)
    else
      session = Sauce::Selenium.new(opts)
    end
    at_exit do
      session.stop
    end
    session.start
    @@cached_sessions[opts] = session
    return session
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sauce-1.0.2 lib/sauce.rb
sauce-1.0.1 lib/sauce.rb
sauce-1.0.0 lib/sauce.rb