Sha256: 4aa747b0a0a04cb94a0363f36f310155f08284e59edf46a328c5c52bca87a63f

Contents?: true

Size: 959 Bytes

Versions: 6

Compression:

Stored size: 959 Bytes

Contents

#! /usr/bin/env ruby -S rspec
require 'spec_helper'
require 'facter/facter_dot_d'

describe Facter::Util::DotD do

  context 'returns a simple fact' do
    before :each do
      Facter.stubs(:version).returns('1.6.1')
      subject.stubs(:entries).returns(['/etc/facter/facts.d/fake_fact.txt'])
      File.stubs(:readlines).with('/etc/facter/facts.d/fake_fact.txt').returns(['fake_fact=fake fact'])
      subject.create
    end

    it 'should return successfully' do
      expect(Facter.fact(:fake_fact).value).to eq('fake fact')
    end
  end

  context 'returns a fact with equals signs' do
    before :each do
      Facter.stubs(:version).returns('1.6.1')
      subject.stubs(:entries).returns(['/etc/facter/facts.d/foo.txt'])
      File.stubs(:readlines).with('/etc/facter/facts.d/foo.txt').returns(['foo=1+1=2'])
      subject.create
    end

    it 'should return successfully' do
      expect(Facter.fact(:foo).value).to eq('1+1=2')
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
puppet-retrospec-0.12.1 spec/fixtures/modules/stdlib/spec/unit/facter/facter_dot_d_spec.rb
puppet-retrospec-0.12.0 spec/fixtures/modules/stdlib/spec/unit/facter/facter_dot_d_spec.rb
puppet-retrospec-0.11.0 spec/fixtures/modules/stdlib/spec/unit/facter/facter_dot_d_spec.rb
puppet-retrospec-0.10.0 spec/fixtures/modules/stdlib/spec/unit/facter/facter_dot_d_spec.rb
puppet-retrospec-0.9.1 spec/fixtures/modules/stdlib/spec/unit/facter/facter_dot_d_spec.rb
puppet-retrospec-0.9.0 spec/fixtures/modules/stdlib/spec/unit/facter/facter_dot_d_spec.rb