Sha256: fb733b8b3106e53e2fb258407db6980a4ebe5828b33a46079e9940f01e54e864

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 KB

Contents

describe Bluepill::System do
  describe :pid_alive? do
    it "should be true if process responds to zero signal" do
      Process.should_receive(:kill).with(0, 555).and_return(0)
      Bluepill::System.should be_pid_alive(555)
    end

    it "should be false if process throws exception on zero signal" do
      Process.should_receive(:kill).with(0, 555).and_raise(Errno::ESRCH)
      Bluepill::System.should_not be_pid_alive(555)
    end
  end

  describe :store do
    it "should be Hash" do
      Bluepill::System.store.should be_kind_of(Hash)
    end

    it "should return same Hash or every call" do
      Bluepill::System.store.should be_equal(Bluepill::System.store) 
    end

    it "should store assigned pairs" do
      Bluepill::System.store[:somekey] = 10
      Bluepill::System.store[:somekey].should be_eql(10) 
    end
  end

  describe :reset_data do
    it 'should clear the #store' do
      Bluepill::System.store[:anotherkey] = Faker::Lorem.sentence
      Bluepill::System.reset_data
      Bluepill::System.store.should be_empty
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
cloud66-bluepill-0.0.64 spec/lib/bluepill/system_spec.rb
cloud66-bluepill-0.0.63 spec/lib/bluepill/system_spec.rb
bluepill-0.0.63 spec/lib/bluepill/system_spec.rb
cloud66-bluepill-0.0.62 spec/lib/bluepill/system_spec.rb