diff options
author | Hunter Haugen <hunter@puppetlabs.com> | 2014-04-22 14:21:44 -0700 |
---|---|---|
committer | Hunter Haugen <hunter@puppetlabs.com> | 2014-04-22 14:21:44 -0700 |
commit | 1bdb213778ac850631f323a46bf6e99d047034f5 (patch) | |
tree | 158f31acabe32a690c7261f99b17b89a21b5257b /spec | |
parent | 6a5dee25a6005280ef86a523192acf9b4d02e7ce (diff) | |
parent | 68acb59bf77d8d818489b1e2a97491cb7f327a0a (diff) |
Merge pull request #242 from apenney/facts_d
Adjust the regular expression for facts.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/facter/facter_dot_d_spec.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/unit/facter/facter_dot_d_spec.rb b/spec/unit/facter/facter_dot_d_spec.rb new file mode 100644 index 0000000..1ecffc8 --- /dev/null +++ b/spec/unit/facter/facter_dot_d_spec.rb @@ -0,0 +1,31 @@ +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 + Facter.fact(:fake_fact).value.should == '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 + Facter.fact(:foo).value.should == '1+1=2' + end + end +end |