spec/lib/plugins/cpu_spec.rb in zabbix-ruby-client-0.0.20 vs spec/lib/plugins/cpu_spec.rb in zabbix-ruby-client-0.0.21

- old
+ new

@@ -30,11 +30,11 @@ "guest" => 0, "used" => 900911, "total" => 193453420 } stubfile = File.expand_path('../../../../spec/files/system/proc_cpu', __FILE__) - ZabbixRubyClient::Plugins::Cpu.stub(:getline).and_return(File.read(stubfile)) + allow(ZabbixRubyClient::Plugins::Cpu).to receive(:getline).and_return(File.read(stubfile)) data = ZabbixRubyClient::Plugins::Cpu.send(:get_info) expect(data).to eq expected end it "populate a hash with extracted data" do @@ -50,11 +50,11 @@ "local cpu[guest] 123456789 0", "local cpu[used] 123456789 900911", "local cpu[total] 123456789 193453420" ] stubfile = File.expand_path('../../../../spec/files/system/proc_cpu', __FILE__) - ZabbixRubyClient::Plugins::Cpu.stub(:getline).and_return(File.read(stubfile)) - Time.stub(:now).and_return("123456789") + allow(ZabbixRubyClient::Plugins::Cpu).to receive(:getline).and_return(File.read(stubfile)) + allow(Time).to receive(:now).and_return("123456789") data = ZabbixRubyClient::Plugins::Cpu.send(:collect, 'local') expect(data).to eq expected end end