Sha256: 072018acc4444b7fffaab471b155e208603b2b8561d766b769c77f0a455dd24b

Contents?: true

Size: 1.09 KB

Versions: 25

Compression:

Stored size: 1.09 KB

Contents

module Sauce
  module Utilities
    class Connect
      def self.start_from_config(config)
        self.start(:host => config[:application_host], :port => config[:application_port], :quiet => true)
      end

      def self.start(options={})
        begin
          require "sauce/connect"
        rescue LoadError => e
          STDERR.puts 'Please install the `sauce-connect` gem if you intend on using Sauce Connect with your tests!'
          exit(1)
        end

        if ParallelTests.first_process?
          unless @tunnel
            @tunnel = Sauce::Connect.new options
            @tunnel.connect
            @tunnel.wait_until_ready
          end
          @tunnel
        else
          while not File.exist? "sauce_connect.ready"
            sleep 0.5
          end
        end
      end

      def self.close
        if @tunnel
          if ParallelTests.first_process?
            ParallelTests.wait_for_other_processes_to_finish
            @tunnel.disconnect
            @tunnel = nil
          end
        end
      end

      class << self
        attr_reader :tunnel
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
sauce_ruby-3.5.11 lib/sauce/utilities/connect.rb
sauce_ruby-3.5.10 lib/sauce/utilities/connect.rb
sauce_ruby-3.5.9 lib/sauce/utilities/connect.rb
sauce_ruby-3.5.8 lib/sauce/utilities/connect.rb
sauce_ruby-3.5.7 lib/sauce/utilities/connect.rb
sauce_ruby-3.5.6 lib/sauce/utilities/connect.rb
sauce-3.5.6 lib/sauce/utilities/connect.rb
sauce-3.5.5 lib/sauce/utilities/connect.rb
sauce-3.5.4 lib/sauce/utilities/connect.rb
sauce-3.5.3 lib/sauce/utilities/connect.rb
sauce-3.5.2 lib/sauce/utilities/connect.rb
sauce-3.5.1 lib/sauce/utilities/connect.rb
sauce-3.5.0 lib/sauce/utilities/connect.rb
sauce-3.4.9 lib/sauce/utilities/connect.rb
sauce-3.4.8 lib/sauce/utilities/connect.rb
sauce-3.4.7 lib/sauce/utilities/connect.rb
sauce-3.4.6 lib/sauce/utilities/connect.rb
sauce-3.4.5 lib/sauce/utilities/connect.rb
sauce-3.4.4 lib/sauce/utilities/connect.rb
sauce-3.4.3 lib/sauce/utilities/connect.rb