|
4 | 4 | describe LegacyFacter::Util::Config do |
5 | 5 | include PuppetlabsSpec::Files |
6 | 6 |
|
7 | | - describe "ENV['HOME'] is unset", unless: LegacyFacter::Util::Root.root? do |
8 | | - around do |example| |
9 | | - Facter::Core::Execution.with_env('HOME' => nil) do |
10 | | - example.run |
11 | | - end |
12 | | - end |
13 | | - |
14 | | - it 'does not set @external_facts_dirs' do |
15 | | - LegacyFacter::Util::Config.setup_default_ext_facts_dirs |
16 | | - expect(LegacyFacter::Util::Config.external_facts_dirs).to be_empty |
17 | | - end |
18 | | - end |
19 | | - |
20 | 7 | describe 'is_windows? function' do |
21 | 8 | it "detects windows if Ruby RbConfig::CONFIG['host_os'] returns a windows OS" do |
22 | 9 | host_os = %w[mswin win32 dos mingw cygwin] |
|
78 | 65 | .to eq [File.join('C:\\Documents', 'PuppetLabs', 'facter', 'facts.d')] |
79 | 66 | end |
80 | 67 |
|
81 | | - it "returns the old and new (AIO) paths under user's home directory when not root" do |
| 68 | + it "returns the old and new (AIO) paths under user's home directory when not root on windows 2008" do |
82 | 69 | allow(LegacyFacter::Util::Root).to receive(:root?).and_return(false) |
| 70 | + allow(LegacyFacter::Util::Config).to receive(:windows?).and_return(true) |
| 71 | + allow(LegacyFacter::Util::Config).to receive(:windows_data_dir).and_return('C:\\ProgramData') |
| 72 | + LegacyFacter::Util::Config.setup_default_ext_facts_dirs |
| 73 | + expect(LegacyFacter::Util::Config.external_facts_dirs) |
| 74 | + .to eq [File.join(ENV['HOME'], '.facter', 'facts.d'), |
| 75 | + File.join(ENV['HOME'], '.puppetlabs', 'opt', 'facter', 'facts.d'), |
| 76 | + File.join('C:\\ProgramData', 'PuppetLabs', 'facter', 'facts.d')] |
| 77 | + end |
| 78 | + |
| 79 | + it "returns the old and new (AIO) paths under user's home directory when not root on windows 2003R2" do |
| 80 | + allow(LegacyFacter::Util::Root).to receive(:root?).and_return(false) |
| 81 | + allow(LegacyFacter::Util::Config).to receive(:windows?).and_return(true) |
| 82 | + allow(LegacyFacter::Util::Config).to receive(:windows_data_dir).and_return('C:\\Documents') |
| 83 | + LegacyFacter::Util::Config.setup_default_ext_facts_dirs |
| 84 | + expect(LegacyFacter::Util::Config.external_facts_dirs) |
| 85 | + .to eq [File.join(ENV['HOME'], '.facter', 'facts.d'), |
| 86 | + File.join(ENV['HOME'], '.puppetlabs', 'opt', 'facter', 'facts.d'), |
| 87 | + File.join('C:\\Documents', 'PuppetLabs', 'facter', 'facts.d')] |
| 88 | + end |
| 89 | + |
| 90 | + it "returns the old and new (AIO) paths under user's home directory when not root on linux" do |
| 91 | + allow(LegacyFacter::Util::Root).to receive(:root?).and_return(false) |
| 92 | + allow(LegacyFacter::Util::Config).to receive(:windows?).and_return(false) |
| 93 | + allow(LegacyFacter::Util::Config).to receive(:windows_data_dir).and_return(nil) |
83 | 94 | LegacyFacter::Util::Config.setup_default_ext_facts_dirs |
84 | 95 | expect(LegacyFacter::Util::Config.external_facts_dirs) |
85 | 96 | .to eq [File.join(ENV['HOME'], '.facter', 'facts.d'), |
86 | | - File.join(ENV['HOME'], '.puppetlabs', 'opt', 'facter', 'facts.d')] |
| 97 | + File.join(ENV['HOME'], '.puppetlabs', 'opt', 'facter', 'facts.d'), |
| 98 | + '/etc/puppetlabs/facter/facts.d', |
| 99 | + '/etc/facter/facts.d/', |
| 100 | + '/opt/puppetlabs/facter/facts.d'] |
87 | 101 | end |
88 | 102 |
|
89 | 103 | it 'includes additional values when user appends to the list' do |
|
0 commit comments