Sha256: 8e6067409d513d20a1a7cb40b2844b91062324d6d9ca679c2cd7b32310e9dcc7

Contents?: true

Size: 1.03 KB

Versions: 7

Compression:

Stored size: 1.03 KB

Contents

require 'aruba/spawn_process'

module Aruba
  describe SpawnProcess do

    let(:process) { SpawnProcess.new('echo "yo"', 0.1, 0.1) }

    describe "#stdout" do
      before { process.run! }

      it "returns the stdout" do
        expect(process.stdout).to eq "yo\n"
      end

      it "returns all the stdout, every time you call it" do
        expect(process.stdout).to eq "yo\n"
        expect(process.stdout).to eq "yo\n"
      end

    end

    describe "#stop" do
      before { process.run! }

      it "sends any output to the reader" do
        reader = double( 'null_object' )
        allow( reader ).to receive( :stderr )
        expect( reader ).to receive( :stdout ).with("yo\n")

        process.stop(reader)
      end
    end

    describe "#run!" do
      context "upon process launch error" do
        let(:process_failure) { SpawnProcess.new('does_not_exists', 1, 1) }

        it "raises a Aruba::LaunchError" do
          expect{process_failure.run!}.to raise_error(::Aruba::LaunchError)
        end
      end
    end

  end
end

Version data entries

7 entries across 5 versions & 2 rubygems

Version Path
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/aruba-0.6.2/spec/aruba/spawn_process_spec.rb
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/aruba-0.6.2/spec/aruba/spawn_process_spec.rb
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/aruba-0.6.1/spec/aruba/spawn_process_spec.rb
aruba-0.6.2 spec/aruba/spawn_process_spec.rb
aruba-0.6.1 spec/aruba/spawn_process_spec.rb
aruba-0.6.0 spec/aruba/spawn_process_spec.rb
aruba-0.5.4 spec/aruba/spawn_process_spec.rb