Sha256: a4d462aec12f80f2422a2deb25dd0ac4119d5b83f1bb1d998eaa73b6c729a819

Contents?: true

Size: 706 Bytes

Versions: 3

Compression:

Stored size: 706 Bytes

Contents

require 'spec_helper'
require 'process_exists'

describe Process do
  it "responds to :exists?" do
    expect(subject).to respond_to(:exists?)
  end

  describe '.exists?' do
    it "returns false when a pid does not exist" do
      expect(subject.exists?(-2)).to be false
    end

    it "returns true when a pid exists" do
      expect(subject.exists?(Process.pid)).to be true
    end

    if running_specs_as_root?
      it "returns true when a pid exists and belongs to another user" do
        # Process ID 1 is usually the init process primarily responsible for starting and shutting down the system.
        expect(subject.exists?(1)).to be true
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
process_exists-0.1.2 spec/process_spec.rb
process_exists-0.1.1 spec/process_spec.rb
process_exists-0.1.0 spec/process_spec.rb