Class: Simulator::TestRun

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/logpoop/simulator/test_run.rb

Constant Summary collapse

EF =
%w{ E F }

Instance Method Summary collapse

Methods included from Base

#clear_screen, included, #simulate, #stop

Constructor Details

#initialize(out) ⇒ TestRun

Returns a new instance of TestRun.



7
8
9
# File 'lib/logpoop/simulator/test_run.rb', line 7

def initialize(out)
  self.out = out
end

Instance Method Details

#a_dot_or_an_e_or_an_fObject



11
12
13
14
15
16
17
# File 'lib/logpoop/simulator/test_run.rb', line 11

def a_dot_or_an_e_or_an_f
  if(rand(100) % 10 == 0)
    EF[rand(EF.length)]
  else
    "."
  end
end

#fake_itObject



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/logpoop/simulator/test_run.rb', line 19

def fake_it
  clear_screen(self.out)
  self.out.puts(Dir.pwd.strip + " $ rake test")
  self.out.puts("(in #{Dir.pwd.strip})")
  self.out.puts("Started")
  while !@stop do
    out.write(a_dot_or_an_e_or_an_f)
    out.flush
    sleep(rand(20) / 50.0)
  end
  clear_screen(self.out)
end