Class: Lucent::Tester

Inherits:
Object
  • Object
show all
Includes:
Shellwords
Defined in:
lib/lucent/tester.rb

Defined Under Namespace

Classes: MockKernel

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command) ⇒ Tester

Returns a new instance of Tester.



12
13
14
15
16
17
18
19
# File 'lib/lucent/tester.rb', line 12

def initialize(command)
  args = shellwords(command)
  @argv = args[1..-1]
  @stdin = StringIO.new
  @stdout = StringIO.new
  @stderr = StringIO.new
  @kernel = MockKernel.new
end

Class Method Details

.app_class=(name) ⇒ Object



8
9
10
# File 'lib/lucent/tester.rb', line 8

def self.app_class=(name)
  @@app_class = name
end

Instance Method Details

#runObject



21
22
23
# File 'lib/lucent/tester.rb', line 21

def run
  @@app_class.new(@argv, @stdin, @stdout, @stderr, @kernel).start
end

#stderrObject



33
34
35
# File 'lib/lucent/tester.rb', line 33

def stderr
  @stderr.string
end

#stdoutObject



29
30
31
# File 'lib/lucent/tester.rb', line 29

def stdout
  @stdout.string
end

#stopObject



25
26
27
# File 'lib/lucent/tester.rb', line 25

def stop
  @kernel.exitstatus
end