Sha256: 910142d640caaf1cabf6baa568ae5577816f76ae0b8aa614c30b0f73be03c3e6

Contents?: true

Size: 1.43 KB

Versions: 15

Compression:

Stored size: 1.43 KB

Contents

#! /usr/bin/env ruby -S rspec

require 'spec_helper'

describe 'Filesystem facts' do
  describe 'on non-Linux OS' do
    it 'should not exist' do
      Facter.fact(:kernel).stubs(:value).returns('SunOS')
      Facter.fact(:filesystems).value.should == nil
    end
  end

  describe 'on Linux' do
    before :each do
      Facter.fact(:kernel).stubs(:value).returns('Linux')
      fixture_data = my_fixture_read('linux')
      Facter::Util::Resolution.expects(:exec) \
        .with('cat /proc/filesystems 2> /dev/null').returns(fixture_data)
      Facter.collection.internal_loader.load(:filesystems)
    end

    after :each do
      Facter.clear
    end

    it 'should exist' do
      Facter.fact(:filesystems).value.should_not == nil
    end

    it 'should detect the correct number of filesystems' do
      Facter.fact(:filesystems).value.split(',').length.should == 6
    end

    # Check that lines from /proc/filesystems that start with 'nodev' are
    # skipped
    it 'should not detect sysfs' do
      Facter.fact(:filesystems).value.split(',').should_not include('sysfs')
    end

    # Check that all other lines are counted as valid filesystems
    it 'should detect ext4' do
      Facter.fact(:filesystems).value.split(',').should include('ext4')
    end

    # fuseblk is never included in the filesystem list
    it 'should not detect fuseblk' do
      Facter.fact(:filesystems).value.split(',').should_not include('fuseblk')
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
facter-1.7.6 spec/unit/filesystems_spec.rb
facter-1.7.5 spec/unit/filesystems_spec.rb
facter-1.7.5.rc2 spec/unit/filesystems_spec.rb
facter-1.7.5.rc1 spec/unit/filesystems_spec.rb
facter-1.7.4 spec/unit/filesystems_spec.rb
facter-1.7.4.rc1 spec/unit/filesystems_spec.rb
facter-1.7.3 spec/unit/filesystems_spec.rb
facter-1.7.3.rc1 spec/unit/filesystems_spec.rb
facter-1.7.2 spec/unit/filesystems_spec.rb
facter-1.7.2.rc1 spec/unit/filesystems_spec.rb
facter-1.7.1 spec/unit/filesystems_spec.rb
facter-1.7.1.rc1 spec/unit/filesystems_spec.rb
facter-1.7.0 spec/unit/filesystems_spec.rb
facter-1.7.0.rc2 spec/unit/filesystems_spec.rb
facter-1.7.0.rc1 spec/unit/filesystems_spec.rb