Sha256: e51b7261f1eb6e98dd44b54d5db0b2256e5bffdd232bef11e1198b7344f7f5c4
Contents?: true
Size: 1020 Bytes
Versions: 2
Compression:
Stored size: 1020 Bytes
Contents
require 'spec_helper' module Nagios module ZFS describe Zpool do let(:zpool) { Zpool.new('tank') } before do Zpool.any_instance.stub(:`).and_return('') end it 'raises an error on empty pool name' do [nil, ''].each do |name| expect { Zpool.new(name) }.to raise_error /missing pool name/ end end describe '#name' do it 'returns the pool name' do expect(zpool.name).to eq('tank') end end describe '#capacity' do it 'returns the capacity' do zpool.should_receive(:query).and_return("tank\t87%\n") expect(zpool.capacity).to eq(87) end end describe '#query' do it 'runs and caches the zpool query for the given pool' do zpool.should_receive(:`).with('zpool list -H -o name,cap tank'). once.and_return('chunky bacon') 2.times { expect(zpool.send(:query)).to eq('chunky bacon') } end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nagios-zfs-0.1.1 | spec/nagios/zfs/zpool_spec.rb |
nagios-zfs-0.1.0 | spec/nagios/zfs/zpool_spec.rb |