From 18d38a814a1eac718c6861b7ffc65d0dc3aef35f Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Wed, 8 Nov 2017 16:13:31 +0100 Subject: [PATCH] Test command and arguments for SpawnProcess --- lib/aruba/processes/basic_process.rb | 4 ++-- spec/aruba/processes/spawn_process_spec.rb | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/aruba/processes/basic_process.rb b/lib/aruba/processes/basic_process.rb index c22be3907..0dc5f5112 100644 --- a/lib/aruba/processes/basic_process.rb +++ b/lib/aruba/processes/basic_process.rb @@ -129,8 +129,6 @@ def inspect alias to_s inspect - private - def command Shellwords.split(commandline).first end @@ -141,6 +139,8 @@ def arguments [] end + private + def truncate(string, max_length) return string if string.length <= max_length string[0, max_length - 1] + ' ...' diff --git a/spec/aruba/processes/spawn_process_spec.rb b/spec/aruba/processes/spawn_process_spec.rb index 8ca22da1a..f0de26d3c 100644 --- a/spec/aruba/processes/spawn_process_spec.rb +++ b/spec/aruba/processes/spawn_process_spec.rb @@ -28,6 +28,11 @@ before(:each) { process.stop } context 'when invoked once' do + it 'has the right args' do + expect(process.command).to eq 'ruby' + expect(process.arguments).to eq ['-e', "warn 'yo'"] + end + it { expect(process.stderr).to eq "yo\n" } end