Sha256: 21387690d1282ce4cc0e6e457f3f4dc0a4eb75c8ed5834580ec89e59fa11de98

Contents?: true

Size: 1.42 KB

Versions: 78

Compression:

Stored size: 1.42 KB

Contents

#! /usr/bin/env ruby

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::Core::Execution.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

78 entries across 78 versions & 1 rubygems

Version Path
facter-2.5.7 spec/unit/filesystems_spec.rb
facter-2.5.7-x86-mingw32 spec/unit/filesystems_spec.rb
facter-2.5.7-x64-mingw32 spec/unit/filesystems_spec.rb
facter-2.5.7-universal-darwin spec/unit/filesystems_spec.rb
facter-2.5.6-x86-mingw32 spec/unit/filesystems_spec.rb
facter-2.5.6-x64-mingw32 spec/unit/filesystems_spec.rb
facter-2.5.6-universal-darwin spec/unit/filesystems_spec.rb
facter-2.5.6 spec/unit/filesystems_spec.rb
facter-2.5.5-x86-mingw32 spec/unit/filesystems_spec.rb
facter-2.5.5-x64-mingw32 spec/unit/filesystems_spec.rb
facter-2.5.5-universal-darwin spec/unit/filesystems_spec.rb
facter-2.5.5 spec/unit/filesystems_spec.rb
facter-2.5.4-x86-mingw32 spec/unit/filesystems_spec.rb
facter-2.5.4-x64-mingw32 spec/unit/filesystems_spec.rb
facter-2.5.4-universal-darwin spec/unit/filesystems_spec.rb
facter-2.5.4 spec/unit/filesystems_spec.rb
facter-2.5.1 spec/unit/filesystems_spec.rb
facter-2.5.1-x86-mingw32 spec/unit/filesystems_spec.rb
facter-2.5.1-x64-mingw32 spec/unit/filesystems_spec.rb
facter-2.5.1-universal-darwin spec/unit/filesystems_spec.rb