File: network_spec.rb

package info (click to toggle)
ruby-vmstat 2.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 344 kB
  • sloc: ruby: 1,136; ansic: 347; makefile: 3
file content (38 lines) | stat: -rw-r--r-- 1,193 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require 'spec_helper'

describe Vmstat::NetworkInterface do
  context "Vmstat#network" do
    let(:network) { Vmstat.network_interfaces }

    it "should return the enthernet and loopback network data as an array" do
      network.should be_a(Array)
    end

    context "loopback device" do
      let(:loopback) { network.find { |interface| interface.loopback? } }
      subject { loopback }

      it "should be a vmstat network interface object" do
        should be_a(described_class)
      end

      context "methods" do
        it { should respond_to(:in_bytes) }
        it { should respond_to(:out_bytes) }
        it { should respond_to(:in_errors) }
        it { should respond_to(:out_errors) }
        it { should respond_to(:in_drops) }
        it { should respond_to(:type) }
      end

      context "content" do
        its(:in_bytes) { should be_a_kind_of(Numeric) }
        its(:out_bytes) { should be_a_kind_of(Numeric) }
        its(:in_errors) { should be_a_kind_of(Numeric) }
        its(:out_errors) { should be_a_kind_of(Numeric) }
        its(:in_drops) { should be_a_kind_of(Numeric) }
        its(:type) { should be_a_kind_of(Numeric) }
      end
    end
  end
end