Sha256: 46ea18e3785ce6af8b706a602dd2cd1b83398fc4eced4df882a27e9c7b6be199

Contents?: true

Size: 992 Bytes

Versions: 3

Compression:

Stored size: 992 Bytes

Contents

require 'aruba/process'

module Aruba
  describe Process do

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

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

      it "returns the stdout" do
        process.stdout(false).should == "yo\n"
      end

      it "returns all the stdout, every time you call it" do
        process.stdout(false).should == "yo\n"
        process.stdout(false).should == "yo\n"
      end

    end

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

      it "sends any output to the reader" do
        reader = stub.as_null_object
        reader.should_receive(:stdout).with("yo\n")
        process.stop(reader, false)
      end
    end

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

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

  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/aruba-0.5.1/spec/aruba/process_spec.rb
librarian-puppet-0.9.8 vendor/gems/ruby/1.9.1/gems/aruba-0.5.1/spec/aruba/process_spec.rb
aruba-0.5.1 spec/aruba/process_spec.rb