Sha256: b4938578b38079ae56a8ebffb4f75a5d69bb942d0bf59b36dcec2be5484940e2
Contents?: true
Size: 1.37 KB
Versions: 46
Compression:
Stored size: 1.37 KB
Contents
require File.dirname(__FILE__) + '/../../spec_helper' include PoolParty::Monitors def vm_stat_str <<-EOE Mach Virtual Memory Statistics: (page size of 4096 bytes) Pages free: 67993. Pages active: 256445. Pages inactive: 124392. Pages wired down: 73762. "Translation faults": 1280661664. Pages copy-on-write: 52365921. Pages zero filled: 722428360. Pages reactivated: 441434. Pageins: 1120320. Pageouts: 285425. Object cache: 11159288 hits of 21753237 lookups (51% hit rate) EOE end describe "MemoryMonitor" do before(:each) do @mon = MemoryMonitor.new MemoryMonitor.stub!(:new).and_return @mon end it "should have the singleton method run defined" do MemoryMonitor.respond_to?(:run).should == true end it "should call the method new" do MemoryMonitor.should_receive(:new).and_return @mon MemoryMonitor.run end describe "calling" do it "should call uname with %x" do @mon.should_receive(:`).with("uname").and_return "Darwin" @mon.stub!(:`).and_return "" end it "should call vm_stat with when the uname returns Darwin" do @mon.should_receive(:`).with("uname").and_return "Darwin" @mon.should_receive(:`).with("vm_stat").and_return vm_stat_str end after(:each) do @mon.run end end end
Version data entries
46 entries across 46 versions & 2 rubygems