summaryrefslogtreecommitdiff
path: root/chef-config/spec
diff options
context:
space:
mode:
authordanielsdeleo <dan@chef.io>2016-01-22 18:19:01 -0800
committerdanielsdeleo <dan@chef.io>2016-01-26 18:12:46 -0800
commit16d041135ad382e9c7ace7081aa30dba520d8310 (patch)
tree6613ad2dd9391aa8403a60844439979ccbedcf66 /chef-config/spec
parentf766e4a564688a75aebc9070269259b5d8adc4a2 (diff)
downloadchef-16d041135ad382e9c7ace7081aa30dba520d8310.tar.gz
Add test for repo_mode behavior
Diffstat (limited to 'chef-config/spec')
-rw-r--r--chef-config/spec/unit/config_spec.rb43
1 files changed, 43 insertions, 0 deletions
diff --git a/chef-config/spec/unit/config_spec.rb b/chef-config/spec/unit/config_spec.rb
index 5983981ddd..ed72577cf7 100644
--- a/chef-config/spec/unit/config_spec.rb
+++ b/chef-config/spec/unit/config_spec.rb
@@ -288,6 +288,49 @@ RSpec.describe ChefConfig::Config do
expect(ChefConfig::Config[:ssl_ca_path]).to be_nil
end
+ describe "ChefConfig::Config[:repo_mode]" do
+
+ context "when local mode is enabled" do
+
+ before { ChefConfig::Config[:local_mode] = true }
+
+ it "defaults to 'hosted_everything'" do
+ expect(ChefConfig::Config[:repo_mode]).to eq("hosted_everything")
+ end
+
+ context "and osc_compat is enabled" do
+
+ before { ChefConfig::Config.chef_zero.osc_compat = true }
+
+ it "defaults to 'everything'" do
+ expect(ChefConfig::Config[:repo_mode]).to eq("everything")
+ end
+ end
+ end
+
+ context "when local mode is not enabled" do
+
+ context "and the chef_server_url is multi-tenant" do
+
+ before { ChefConfig::Config[:chef_server_url] = "https://chef.example/organizations/example" }
+
+ it "defaults to 'hosted_everything'" do
+ expect(ChefConfig::Config[:repo_mode]).to eq("hosted_everything")
+ end
+
+ end
+
+ context "and the chef_server_url is not multi-tenant" do
+
+ before { ChefConfig::Config[:chef_server_url] = "https://chef.example/" }
+
+ it "defaults to 'everything'" do
+ expect(ChefConfig::Config[:repo_mode]).to eq("everything")
+ end
+ end
+ end
+ end
+
# On Windows, we'll detect an omnibus build and set this to the
# cacert.pem included in the package, but it's nil if you're on Windows
# w/o omnibus (e.g., doing development on Windows, custom build, etc.)