Class: Foodtaster::RSpecRun

Inherits:
Object
  • Object
show all
Defined in:
lib/foodtaster/rspec_run.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRSpecRun

Returns a new instance of RSpecRun.



5
6
7
8
9
# File 'lib/foodtaster/rspec_run.rb', line 5

def initialize
  @client = nil
  @server_process = nil
  @stopped = false
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



3
4
5
# File 'lib/foodtaster/rspec_run.rb', line 3

def client
  @client
end

Class Method Details

.currentObject



40
41
42
# File 'lib/foodtaster/rspec_run.rb', line 40

def current
  @instance ||= self.new
end

Instance Method Details

#startObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/foodtaster/rspec_run.rb', line 11

def start
  setup_signal_handlers
  start_server_and_connect_client

  if @client && @server_process && !@server_process.alive?
    Foodtaster.logger.fatal "Failed to start Foodtaster DRb Server:\n\n#{@server_process.output}"
    exit 1
  elsif !@client || !@server_process
    Foodtaster.logger.fatal "Failed to connect to Foodtaster DRb Server"
    exit 1
  end
end

#stopObject



24
25
26
27
28
29
30
31
# File 'lib/foodtaster/rspec_run.rb', line 24

def stop
  return if @stopped

  @stopped = true
  puts "" # newline after rspec output
  Vm.shutdown_running_vms if Foodtaster.config.shutdown_vms
  terminate_server
end