2 require 'facter/root_home'
4 describe Facter::Util::RootHome do
6 let(:root_ent) { "root:x:0:0:Super-User:/:/sbin/sh" }
7 let(:expected_root_home) { "/" }
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
15 let(:root_ent) { "root:x:0:0:root:/root:/bin/bash" }
16 let(:expected_root_home) { "/root" }
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
24 let(:root_ent) { "root:*:0:0:System Administrator:/var/root:/bin/sh" }
25 let(:expected_root_home) { "/var/root" }
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
33 let(:root_ent) { "FIXME TBD on Windows" }
34 let(:expected_root_home) { "FIXME TBD on Windows" }
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