Sha256: 7aba387e475ba6bb98564b54e8db1dda558379e52f52f5f35d332a3e97a84911

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

#######################################################################
# linux_kstat_spec.rb
#
# Test suite for the linux-kstat library.
#######################################################################
require 'rspec'
require 'linux/kstat'

describe Linux::Kstat do
  let(:kstat){ Linux::Kstat.new }

  context "constants" do
    it "defines a version constant that is set to the expected value" do
      expect(Linux::Kstat::VERSION).to eql('0.2.1')
      expect(Linux::Kstat::VERSION.frozen?).to be(true)
    end
  end

  context "hash access" do
    it "allows hash style key access" do
      expect(subject).to respond_to(:[])
      expect{ subject[:cpu] }.to_not raise_error
    end

    it "contains the expected keys and value types" do
      expect(kstat[:cpu]).to be_kind_of(Hash)
      expect(kstat[:btime]).to be_kind_of(Numeric)
      expect(kstat[:intr]).to be_kind_of(Array)
    end

    it "does not allow key assignment" do
      expect{ subject[:cpu] = 'test' }.to raise_error(NoMethodError)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
linux-kstat-0.2.1-universal-linux spec/linux_kstat_spec.rb