]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/stdlib/spec/unit/facter/root_home_spec.rb
upgrade to concat 2.0.0
[dsa-puppet.git] / modules / stdlib / spec / unit / facter / root_home_spec.rb
1 require 'spec_helper'
2 require 'facter/root_home'
3
4 describe Facter::Util::RootHome do
5   context "solaris" do
6     let(:root_ent) { "root:x:0:0:Super-User:/:/sbin/sh" }
7     let(:expected_root_home) { "/" }
8
9     it "should return /" do
10       Facter::Util::Resolution.expects(:exec).with("getent passwd root").returns(root_ent)
11       Facter::Util::RootHome.get_root_home.should == expected_root_home
12     end
13   end
14   context "linux" do
15     let(:root_ent) { "root:x:0:0:root:/root:/bin/bash" }
16     let(:expected_root_home) { "/root" }
17
18     it "should return /root" do
19       Facter::Util::Resolution.expects(:exec).with("getent passwd root").returns(root_ent)
20       Facter::Util::RootHome.get_root_home.should == expected_root_home
21     end
22   end
23   context "macosx" do
24     let(:root_ent) { "root:*:0:0:System Administrator:/var/root:/bin/sh" }
25     let(:expected_root_home) { "/var/root" }
26
27     it "should return /var/root" do
28       Facter::Util::Resolution.expects(:exec).with("getent passwd root").returns(root_ent)
29       Facter::Util::RootHome.get_root_home.should == expected_root_home
30     end
31   end
32   context "windows" do
33     let(:root_ent) { "FIXME TBD on Windows" }
34     let(:expected_root_home) { "FIXME TBD on Windows" }
35
36     it "should return FIXME TBD on windows" do
37       pending "FIXME: TBD on windows"
38       Facter::Util::Resolution.expects(:exec).with("getent passwd root").returns(root_ent)
39       Facter::Util::RootHome.get_root_home.should == expected_root_home
40     end
41   end
42 end