diff options
author | Claire McQuin <claire@getchef.com> | 2014-05-21 12:13:54 -0700 |
---|---|---|
committer | Claire McQuin <claire@getchef.com> | 2014-05-22 12:16:36 -0700 |
commit | 7c65a72f19a80d5d8f4acae766a669811ce03eac (patch) | |
tree | 80a1621aba69b9c6696e1917d9163a2db3c403cf /spec/unit/config_spec.rb | |
parent | 08f3547a39cb2390425587860208513cba9eab3f (diff) | |
download | chef-7c65a72f19a80d5d8f4acae766a669811ce03eac.tar.gz |
fix stubs for windows
Diffstat (limited to 'spec/unit/config_spec.rb')
-rw-r--r-- | spec/unit/config_spec.rb | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/spec/unit/config_spec.rb b/spec/unit/config_spec.rb index 779f97ab9e..c467d7d553 100644 --- a/spec/unit/config_spec.rb +++ b/spec/unit/config_spec.rb @@ -148,17 +148,18 @@ describe Chef::Config do def secondary_cache_path if windows? - "#{Chef::Config.env['SYSTEMDRIVE']}\\#{Chef::Config.env['HOMEPATH']}\\.chef" + "#{Chef::Config[:user_home]}\\.chef" else - "#{Chef::Config.env['HOME']}/.chef" + "#{Chef::Config[:user_home]}/.chef" end end before do if windows? - Chef::Config.stub(:env).and_return({'SYSTEMDRIVE' => "C:", 'HOMEPATH' => "KittenHome"}) + Chef::Config.stub(:env).and_return({ 'SYSTEMDRIVE' => 'C:' }) + Chef::Config[:user_home] = 'C:\Users\charlie' else - Chef::Config.stub(:env).and_return({'HOME' => "/Users/kitten"}) + Chef::Config[:user_home] = '/Users/charlie' end Chef::Config.stub(:path_accessible?).and_return(false) @@ -167,7 +168,7 @@ describe Chef::Config do describe "Chef::Config[:cache_path]" do context "when /var/chef exists and is accessible" do it "defaults to /var/chef" do - Chef::Config.stub(:path_accessible?).and_return(true) + Chef::Config.stub(:path_accessible?).with(Chef::Config.platform_specific_path("/var/chef")).and_return(true) Chef::Config[:cache_path].should == primary_cache_path end end @@ -200,8 +201,8 @@ describe Chef::Config do end it "Chef::Config[:file_backup_path] defaults to /var/chef/backup" do - Chef::Config.stub(:cache_path).and_return(Chef::Config.platform_specific_path("/var/chef")) - backup_path = Chef::Config.platform_specific_path("#{Chef::Config.cache_path}/backup") + Chef::Config.stub(:cache_path).and_return(primary_cache_path) + backup_path = windows? ? "#{primary_cache_path}\\backup" : "#{primary_cache_path}/backup" Chef::Config[:file_backup_path].should == backup_path end @@ -224,16 +225,14 @@ describe Chef::Config do end it "Chef::Config[:data_bag_path] defaults to /var/chef/data_bags" do - Chef::Config.stub(:cache_path).and_return(Chef::Config.platform_specific_path("/var/chef")) - data_bag_path = - Chef::Config.platform_specific_path("#{Chef::Config.cache_path}/data_bags") + Chef::Config.stub(:cache_path).and_return(primary_cache_path) + data_bag_path = windows? ? "#{primary_cache_path}\\data_bags" : "#{primary_cache_path}/data_bags" Chef::Config[:data_bag_path].should == data_bag_path end it "Chef::Config[:environment_path] defaults to /var/chef/environments" do - Chef::Config.stub(:cache_path).and_return(Chef::Config.platform_specific_path("/var/chef")) - environment_path = Chef::Config.platform_specific_path("#{Chef::Config.cache_path}/environments") - + Chef::Config.stub(:cache_path).and_return(primary_cache_path) + environment_path = windows? ? "#{primary_cache_path}\\environments" : "#{primary_cache_path}/environments" Chef::Config[:environment_path].should == environment_path end |