Class: InfinityTest::ContinuousTesting

Inherits:
Object
  • Object
show all
Defined in:
lib/infinity_test/continuous_testing.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeContinuousTesting

Returns a new instance of ContinuousTesting.



5
6
7
8
# File 'lib/infinity_test/continuous_testing.rb', line 5

def initialize
  @application = InfinityTest.application
  @watchr = InfinityTest.watchr
end

Instance Attribute Details

#applicationObject

Returns the value of attribute application.



3
4
5
# File 'lib/infinity_test/continuous_testing.rb', line 3

def application
  @application
end

#global_commandsObject

Returns the value of attribute global_commands.



3
4
5
# File 'lib/infinity_test/continuous_testing.rb', line 3

def global_commands
  @global_commands
end

#watchrObject

Returns the value of attribute watchr.



3
4
5
# File 'lib/infinity_test/continuous_testing.rb', line 3

def watchr
  @watchr
end

Instance Method Details

#add_signalObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/infinity_test/continuous_testing.rb', line 24

def add_signal
  Signal.trap 'INT' do
    if @sent_an_int then
       puts " Shutting down now"
       exit
    else
       puts " Interrupt a second time to quit"
       @sent_an_int = true
       Kernel.sleep 1.1
       @application.run_global_commands!
       @sent_an_int = false
    end
  end
end

#initialize_watchr!Object Also known as: start!

Watchr Methods #



14
15
16
17
# File 'lib/infinity_test/continuous_testing.rb', line 14

def initialize_watchr!
  add_signal
  run_with_watchr!
end

#run_with_watchr!Object



20
21
22
# File 'lib/infinity_test/continuous_testing.rb', line 20

def run_with_watchr!
  Watchr::Controller.new(@watchr, Watchr.handler.new).run
end