Sha256: b2e2bb61dde1739cda1701a850d1e6bc0992308b7ec17565f59ecb0b6f809d2a

Contents?: true

Size: 1.78 KB

Versions: 1

Compression:

Stored size: 1.78 KB

Contents

# frozen_string_literal: true

require 'active_support/core_ext/numeric/bytes'
require 'sys-memory'

RSpec.describe Sys::Memory do
  context 'Sys::Memory::VERSION' do
    example 'the version constant is set to the expected value' do
      expect(described_class::VERSION).to eq('0.1.2')
      expect(described_class::VERSION).to be_frozen
    end
  end

  context 'Sys::Memory.memory' do
    example 'the memory singleton method is defined' do
      expect(described_class).to respond_to(:memory)
    end

    example 'the memory singleton method returns the expected hash' do
      expect(described_class.memory).to be_kind_of(Hash)
      expect(described_class.memory.size).to be > 4
    end
  end

  context 'Sys::Memory.total' do
    example 'the total singleton method is defined' do
      expect(described_class).to respond_to(:total)
    end

    example 'the total singleton method returns a sane value' do
      expect(described_class.total).to be > 64.megabytes
    end
  end

  context 'Sys::Memory.free' do
    example 'the free singleton method is defined' do
      expect(described_class).to respond_to(:free)
    end

    example 'the free singleton method returns a sane value' do
      expect(described_class.free).to be > 64.megabytes
    end
  end

  context 'Sys::Memory.used' do
    example 'the used singleton method is defined' do
      expect(described_class).to respond_to(:used)
    end

    example 'the used singleton method returns a sane value' do
      expect(described_class.used).to be > 64.megabytes
    end
  end

  context 'Sys::Memory.load' do
    example 'the load singleton method is defined' do
      expect(described_class).to respond_to(:load)
    end

    example 'the load singleton method returns a sane value' do
      expect(described_class.load).to be > 1
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sys-memory-0.1.2 spec/sys_memory_spec.rb