Sha256: a6c5be7f858bec68072fd78e882634ae63bb9f3fa92a526e48a4b5d22a58533f
Contents?: true
Size: 1.21 KB
Versions: 21
Compression:
Stored size: 1.21 KB
Contents
require File.dirname(__FILE__) + '/base' describe Rush::ProcessSet do before do @process = mock('process') @set = Rush::ProcessSet.new([ @process ]) end it "is Enumerable" do @set.select { |s| s == @process }.should == [ @process ] end it "defines size" do @set.size.should == 1 end it "defines first" do @set.first.should == @process end it "is equal to sets with the same contents" do @set.should == Rush::ProcessSet.new([ @process ]) end it "is equal to arrays with the same contents" do @set.should == [ @process ] end it "kills all processes in the set" do @process.should_receive(:kill) @set.kill end it "checks the alive? state of all processes in the set" do @process.should_receive(:alive?).and_return(true) @set.alive?.should == [ true ] end it "filters the set from a conditions hash and returns the filtered set" do @process.stub!(:pid).and_return(123) @set.filter(:pid => 123).first.should == @process @set.filter(:pid => 456).size.should == 0 end it "filters with regexps if provided in the conditions" do @process.stub!(:command).and_return('foobaz') @set.filter(:command => /baz/).first.should == @process @set.filter(:command => /blerg/).size.should == 0 end end
Version data entries
21 entries across 21 versions & 4 rubygems
Version | Path |
---|---|
rush-0.4 | spec/process_set_spec.rb |