Sha256: 36ae7b58d8be15fe1cebeed8a368f958386951d8b121c74a3369d2b12cf82c99

Contents?: true

Size: 819 Bytes

Versions: 93

Compression:

Stored size: 819 Bytes

Contents

#! /usr/bin/env ruby

require 'spec_helper'

describe Facter do
  before do
    Facter.reset
  end

  after do
    Facter.reset
  end

  it "should create a new collection if one does not exist" do
    Facter.reset
    coll = mock('coll')
    Facter::Util::Collection.stubs(:new).returns coll
    Facter.collection.should equal(coll)
    Facter.reset
  end

  it "should remove the collection when reset" do
    old = Facter.collection
    Facter.reset
    Facter.collection.should_not equal(old)
  end

  it "should raise an error if a recursion is detected" do
    Facter.clear
    Facter.add(:foo) do
      confine :bar => 'some_value'
    end
    Facter.add(:bar) do
      confine :foo => 'some_value'
    end
    lambda { Facter.value(:foo) }.should raise_error(RuntimeError, /Caught recursion on foo/)
  end

end

Version data entries

93 entries across 93 versions & 1 rubygems

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