summaryrefslogtreecommitdiff
path: root/spec/unit/config_spec.rb
diff options
context:
space:
mode:
authorSeth Chisamore <schisamo@opscode.com>2013-04-17 13:31:24 -0400
committerSeth Chisamore <schisamo@opscode.com>2013-04-17 13:31:24 -0400
commit016aaa18d7482de0fbe1b5113af6890e288c2190 (patch)
treef5f0552b77e3cbec1cfb4bbf1ecf0b74a69ae7c8 /spec/unit/config_spec.rb
parente618bb6a63eea08e1b0fec16df68fac9e90b4967 (diff)
downloadchef-016aaa18d7482de0fbe1b5113af6890e288c2190.tar.gz
[CHEF-4011] use `platform_specific_path` helper in specs
This will fix the following test failures when specs are run on Windows: 1) Chef::Config Chef::Config[:encrypted_data_bag_secret] /etc/chef/encrypted_data_bag_secret exists sets the value to /etc/chef/encrypted_data_bag_secret Failure/Error: require 'chef/config' <File (class)> received :exist? with unexpected arguments expected: ("/etc/chef/encrypted_data_bag_secret") got: ("C:\\chef\\encrypted_data_bag_secret") Please stub a default value first if message might be received with other args as well. # C:/jenkins/workspace/chef-ruby1.9.2-windows/lib/chef/config.rb:280:in `<class:Config>' # C:/jenkins/workspace/chef-ruby1.9.2-windows/lib/chef/config.rb:25:in `<class:Chef>' # C:/jenkins/workspace/chef-ruby1.9.2-windows/lib/chef/config.rb:24:in `<top (required)>' # C:/jenkins/workspace/chef-ruby1.9.2-windows/spec/unit/config_spec.rb:273:in `require' # C:/jenkins/workspace/chef-ruby1.9.2-windows/spec/unit/config_spec.rb:273:in `block (3 levels) in <top (required)>'
Diffstat (limited to 'spec/unit/config_spec.rb')
-rw-r--r--spec/unit/config_spec.rb12
1 files changed, 5 insertions, 7 deletions
diff --git a/spec/unit/config_spec.rb b/spec/unit/config_spec.rb
index 96e720dc3a..4ae8fbda96 100644
--- a/spec/unit/config_spec.rb
+++ b/spec/unit/config_spec.rb
@@ -230,12 +230,8 @@ describe Chef::Config do
end
it "Chef::Config[:data_bag_path] defaults to /var/chef/data_bags" do
- data_bag_path = if windows?
- "C:\\chef\\data_bags"
- else
- "/var/chef/data_bags"
- end
-
+ data_bag_path =
+ Chef::Config.platform_specific_path("/var/chef/data_bags")
Chef::Config[:data_bag_path].should == data_bag_path
end
end
@@ -262,7 +258,9 @@ describe Chef::Config do
end
describe "Chef::Config[:encrypted_data_bag_secret]" do
- db_secret_default_path = "/etc/chef/encrypted_data_bag_secret"
+ db_secret_default_path =
+ Chef::Config.platform_specific_path("/etc/chef/encrypted_data_bag_secret")
+
let(:db_secret_default_path){ db_secret_default_path }
before do