d65d2354a7
This conversion is done by Transpec 2.2.1 with the following command: transpec spec/unit * 53 conversions from: obj.should to: expect(obj).to * 19 conversions from: == expected to: eq(expected) * 5 conversions from: lambda { }.should to: expect { }.to * 2 conversions from: be_true to: be_truthy For more details: https://github.com/yujinakayama/transpec#supported-conversions
32 lines
959 B
Ruby
Executable file
32 lines
959 B
Ruby
Executable file
#! /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
|