Sha256: 09008db086012d4307a3cdc59e6e393f369783ebc92e7016d3154680535acfb5
Contents?: true
Size: 1.51 KB
Versions: 3
Compression:
Stored size: 1.51 KB
Contents
require 'aruba/processes/spawn_process' RSpec.describe Aruba::Processes::SpawnProcess do subject(:process) { described_class.new(command, exit_timeout, io_wait, working_directory) } let(:command) { 'echo "yo"' } let(:exit_timeout) { 1 } let(:io_wait) { 1 } let(:working_directory) { Dir.getwd } describe "#stdout" do before(:each) { process.run! } context 'when invoked once' do it { expect(process.stdout).to eq "yo\n" } end context 'when invoked twice' do it { 2.times { expect(process.stdout).to eq "yo\n" } } end end describe "#stderr" do let(:command) { 'features/fixtures/spawn_process/stderr.sh yo' } before(:each) { process.run! } context 'when invoked once' do it { expect(process.stderr).to eq "yo\n" } end context 'when invoked twice' do it { 2.times { expect(process.stderr).to eq "yo\n" } } end end describe "#stop" do let(:reader) { double('reader') } before(:each) { process.run! } before :each do allow(reader).to receive(:announce).with(:stderr, '') expect(reader).to receive(:announce).with(:stdout, "yo\n") end context 'when stopped successfully' do it { process.stop(reader) } end end describe "#run!" do context "when process run succeeds" do it { expect { process.run! }.not_to raise_error } end context "when process run fails" do let(:command) { 'does_not_exists' } it { expect {process.run!}.to raise_error Aruba::LaunchError } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
aruba-0.7.4 | spec/aruba/spawn_process_spec.rb |
aruba-0.7.3 | spec/aruba/spawn_process_spec.rb |
aruba-0.7.2 | spec/aruba/spawn_process_spec.rb |