Class: Sauce::Utilities::Connect

Inherits:
Object
  • Object
show all
Defined in:
lib/sauce/utilities/connect.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.tunnelObject (readonly)

Returns the value of attribute tunnel.



41
42
43
# File 'lib/sauce/utilities/connect.rb', line 41

def tunnel
  @tunnel
end

Class Method Details

.closeObject



30
31
32
33
34
35
36
37
38
# File 'lib/sauce/utilities/connect.rb', line 30

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

.start(options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/sauce/utilities/connect.rb', line 8

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

.start_from_config(config) ⇒ Object



4
5
6
# File 'lib/sauce/utilities/connect.rb', line 4

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