Class: Lucent::Tester
- Inherits:
-
Object
- Object
- Lucent::Tester
- Includes:
- Shellwords
- Defined in:
- lib/lucent/tester.rb
Defined Under Namespace
Classes: MockKernel
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(command) ⇒ Tester
constructor
A new instance of Tester.
- #run ⇒ Object
- #stderr ⇒ Object
- #stdout ⇒ Object
- #stop ⇒ Object
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
#run ⇒ Object
21 22 23 |
# File 'lib/lucent/tester.rb', line 21 def run @@app_class.new(@argv, @stdin, @stdout, @stderr, @kernel).start end |
#stderr ⇒ Object
33 34 35 |
# File 'lib/lucent/tester.rb', line 33 def stderr @stderr.string end |
#stdout ⇒ Object
29 30 31 |
# File 'lib/lucent/tester.rb', line 29 def stdout @stdout.string end |
#stop ⇒ Object
25 26 27 |
# File 'lib/lucent/tester.rb', line 25 def stop @kernel.exitstatus end |