spec/lib/plugins/network_spec.rb in zabbix-ruby-client-0.1.2 vs spec/lib/plugins/network_spec.rb in zabbix-ruby-client-0.1.3

- old
+ new

@@ -1,8 +1,9 @@ # encoding: utf-8 require 'spec_helper' +require "zabbix-ruby-client/plugin_base" require "zabbix-ruby-client/plugins" ZabbixRubyClient::Plugins.scan_dirs ["zabbix-ruby-client/plugins"] require "zabbix-ruby-client/plugins/network" describe ZabbixRubyClient::Plugins::Network do @@ -16,28 +17,20 @@ after :all do FileUtils.rm_rf @logfile if File.exists? @logfile end it "prepare data to be usable" do - expected = [ - "eth0:", - "8523363858", - "17554648", - "0", - "0", - "0", - "0", - "0", - "589997", - "2479556217", - "15780062", - "0", - "0", - "0", - "0", - "0", - "0" - ] + expected = { + :rx_drop => "0", + :rx_err => "0", + :rx_ok => "8523363858", + :rx_packets => "17554648", + :tx_drop => "0", + :tx_err => "0", + :tx_ok => "2479556217", + :tx_packets => "15780062" + } + stubfile = File.expand_path('../../../../spec/files/system/net_dev', __FILE__) allow(ZabbixRubyClient::Plugins::Network).to receive(:getline).and_return(File.read(stubfile)) data = ZabbixRubyClient::Plugins::Network.send(:get_info, 'eth0') expect(data).to eq expected end