Sha256: ee540f34f380bb72907cea8f1c284781b77f79f95b7f01420850b731c0cedcab

Contents?: true

Size: 844 Bytes

Versions: 1

Compression:

Stored size: 844 Bytes

Contents

require File.dirname(__FILE__) + '/base'

describe Rush::Process do
	before do
		@pid = fork do
			sleep 999
		end
		@process = Rush::Process.all.detect { |p| p.pid == @pid }
	end

	after do
		system "kill -9 #{@pid}"
	end

	it "gets the list of all processes" do
		list = Rush::Process.all
		list.size.should > 5
		list.first.should be_kind_of(Rush::Process)
	end

	it "knows the pid" do
		@process.pid.should == @pid
	end

	it "knows the uid" do
		@process.uid.should == ::Process.uid
	end

	it "knows the executed binary" do
		@process.command.should == "ruby"
	end

	it "knows the command line" do
		@process.cmdline.should match(/process_spec.rb/)
	end

	it "can kill itself" do
		system "sleep 30 &"
		@process = Rush::Process.all.detect { |p| p.command == "sleep" }
		@process.kill
		sleep 0.1
		@process.alive?.should be_false
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rush-0.1 spec/process_spec.rb