summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVivek Singh <vivek.singh@msystechnologies.com>2019-02-08 23:00:23 +0530
committerTim Smith <tsmith@chef.io>2019-03-04 09:42:06 -0800
commit75e5da209f721faae5bcb49e90f559d36ef2b4dd (patch)
treef88ddef86e88522f853c4cbe2330f565941fef88
parent4cf607b21e547f8e23e16f5d84b254938fa29fc3 (diff)
downloadchef-75e5da209f721faae5bcb49e90f559d36ef2b4dd.tar.gz
Added specs
Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
-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