Sha256: a100069fd41367aa96a7106493609a2b738f9126842aa261b0f81eb29dbb6d94

Contents?: true

Size: 735 Bytes

Versions: 3

Compression:

Stored size: 735 Bytes

Contents

require 'spec_helper'

describe EventedBluepill::ProcessConditions::CpuUsage do
  before do
    @condition = EventedBluepill::ProcessConditions::CpuUsage.new 'name', stub(:actual_pid => 0), :below => 2
  end

  describe "#run" do
    it "must return current cpu usage" do
      EventedBluepill::System.expects(:cpu_usage).with(0).returns(1.1)
      @condition.run.must_equal 1.1
    end
  end

  describe "#check" do
    it "must be true if value is below threshold" do
      @condition.check(0).must_equal true
    end

    it "must be false if value is above threshold" do
      @condition.check(4).must_equal false
    end

    it "must be false if value is threshold" do
      @condition.check(2).must_equal false
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
evented_bluepill-0.0.52 spec/cpu_usage_spec.rb
evented_bluepill-0.0.51 spec/cpu_usage_spec.rb
evented_bluepill-0.0.50 spec/cpu_usage_spec.rb