summaryrefslogtreecommitdiff
path: root/chef-config/spec
diff options
context:
space:
mode:
authorVivek Singh <vivek.singh@msystechnologies.com>2019-02-08 23:00:23 +0530
committerVivek Singh <vivek.singh@msystechnologies.com>2019-02-08 23:00:23 +0530
commit7dc9e6c404e698f87beadf14f73f1dda4c505421 (patch)
treedf77cc9437173d4e603fd3b6161d707818dd5564 /chef-config/spec
parent35be84501c549800ccdbd8570befcbd3099048dd (diff)
downloadchef-7dc9e6c404e698f87beadf14f73f1dda4c505421.tar.gz
Added specs
Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
Diffstat (limited to 'chef-config/spec')
-rw-r--r--chef-config/spec/unit/config_spec.rb29
1 files changed, 26 insertions, 3 deletions
diff --git a/chef-config/spec/unit/config_spec.rb b/chef-config/spec/unit/config_spec.rb
index 7e32a1e742..b6e88f0bc8 100644
--- a/chef-config/spec/unit/config_spec.rb
+++ b/chef-config/spec/unit/config_spec.rb
@@ -644,11 +644,11 @@ RSpec.describe ChefConfig::Config do
context "when the user's home dir is /home/charlie/" do
before do
- ChefConfig::Config.user_home = to_platform("/home/charlie")
+ ChefConfig::Config.user_home = "/home/charlie/"
end
it "config_dir is /home/charlie/.chef/" do
- expect(ChefConfig::Config.config_dir).to eq(ChefConfig::PathHelper.join(to_platform("/home/charlie/.chef"), ""))
+ expect(ChefConfig::Config.config_dir).to eq(ChefConfig::PathHelper.join(ChefConfig::PathHelper.cleanpath("/home/charlie/"), ".chef", ""))
end
context "and chef is running in local mode" do
@@ -657,11 +657,34 @@ RSpec.describe ChefConfig::Config do
end
it "config_dir is /home/charlie/.chef/" do
- expect(ChefConfig::Config.config_dir).to eq(ChefConfig::PathHelper.join(to_platform("/home/charlie/.chef"), ""))
+ expect(ChefConfig::Config.config_dir).to eq(ChefConfig::PathHelper.join(ChefConfig::PathHelper.cleanpath("/home/charlie/"), ".chef", ""))
end
end
end
+ if is_windows
+ context "when the user's home dir is windows specific" do
+ before do
+ ChefConfig::Config.user_home = to_platform("/home/charlie/")
+ end
+
+ it "config_dir is with backslashes" do
+ expect(ChefConfig::Config.config_dir).to eq(ChefConfig::PathHelper.join(ChefConfig::PathHelper.cleanpath("/home/charlie/"), ".chef", ""))
+ end
+
+ context "and chef is running in local mode" do
+ before do
+ ChefConfig::Config.local_mode = true
+ end
+
+ it "config_dir is with backslashes" do
+ expect(ChefConfig::Config.config_dir).to eq(ChefConfig::PathHelper.join(ChefConfig::PathHelper.cleanpath("/home/charlie/"), ".chef", ""))
+ end
+ end
+ end
+
+ end
+
end
if is_windows