diff options
author | Andrew Parker <andy@puppetlabs.com> | 2014-01-28 10:52:58 -0800 |
---|---|---|
committer | Andrew Parker <andy@puppetlabs.com> | 2014-01-28 10:52:58 -0800 |
commit | a2e9d005c731e496d6ed3ce7ff68f50906929c2c (patch) | |
tree | 68d7ec6ed3b03844d40711409c1bccf603bcaac3 /spec | |
parent | 2c8450d830453e452b819bfb05678768336c3031 (diff) | |
parent | fe676f0ac4e1d96e77ba7fe894408d8e7647eacc (diff) |
Merge pull request #215 from blkperl/add_root_home_to_mavericks
(PUP-1459) Add support for root_home on OS X 10.9
Diffstat (limited to 'spec')
-rw-r--r-- | spec/fixtures/dscacheutil/root | 8 | ||||
-rw-r--r-- | spec/unit/facter/root_home_spec.rb | 29 |
2 files changed, 28 insertions, 9 deletions
diff --git a/spec/fixtures/dscacheutil/root b/spec/fixtures/dscacheutil/root new file mode 100644 index 0000000..1e34519 --- /dev/null +++ b/spec/fixtures/dscacheutil/root @@ -0,0 +1,8 @@ +name: root +password: * +uid: 0 +gid: 0 +dir: /var/root +shell: /bin/bash +gecos: rawr Root + diff --git a/spec/unit/facter/root_home_spec.rb b/spec/unit/facter/root_home_spec.rb index ce80684..532fae1 100644 --- a/spec/unit/facter/root_home_spec.rb +++ b/spec/unit/facter/root_home_spec.rb @@ -20,15 +20,6 @@ describe Facter::Util::RootHome do Facter::Util::RootHome.get_root_home.should == expected_root_home end end - context "macosx" do - let(:root_ent) { "root:*:0:0:System Administrator:/var/root:/bin/sh" } - let(:expected_root_home) { "/var/root" } - - it "should return /var/root" do - Facter::Util::Resolution.expects(:exec).with("getent passwd root").returns(root_ent) - Facter::Util::RootHome.get_root_home.should == expected_root_home - end - end context "windows" do before :each do Facter::Util::Resolution.expects(:exec).with("getent passwd root").returns(nil) @@ -38,3 +29,23 @@ describe Facter::Util::RootHome do end end end + +describe 'root_home', :type => :fact do + before { Facter.clear } + after { Facter.clear } + + context "macosx" do + before do + Facter.fact(:kernel).stubs(:value).returns("Darwin") + Facter.fact(:osfamily).stubs(:value).returns("Darwin") + end + let(:expected_root_home) { "/var/root" } + sample_dscacheutil = File.read(fixtures('dscacheutil','root')) + + it "should return /var/root" do + Facter::Util::Resolution.stubs(:exec).with("dscacheutil -q user -a name root").returns(sample_dscacheutil) + Facter.fact(:root_home).value.should == expected_root_home + end + end + +end |