summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2019-06-18 16:05:07 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2019-06-18 16:06:28 -0700
commite3673313251d74c056c68034fa45af315948bec3 (patch)
tree3f196a1bc6f457dc286bbff45f32f07084247792 /spec
parentb1ce96c8f41a28106f2308b4041eb08236f77470 (diff)
downloadchef-e3673313251d74c056c68034fa45af315948bec3.tar.gz
Move the data collector should_be_enabled? checklcg/move-dc-check
This works better as part of the module that handles all the config wrangling. It isn't central to the data_collector operation itself. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/data_collector_spec.rb34
1 files changed, 17 insertions, 17 deletions
diff --git a/spec/unit/data_collector_spec.rb b/spec/unit/data_collector_spec.rb
index fed0e54b45..d7b18b3c28 100644
--- a/spec/unit/data_collector_spec.rb
+++ b/spec/unit/data_collector_spec.rb
@@ -265,77 +265,77 @@ describe Chef::DataCollector do
describe "#should_be_enabled?" do
shared_examples_for "a solo-like run" do
it "is disabled in solo-legacy without a data_collector url and token" do
- expect(data_collector.send(:should_be_enabled?)).to be false
+ expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be false
end
it "is disabled in solo-legacy with only a url" do
Chef::Config[:data_collector][:server_url] = "https://www.esa.local/ariane5"
- expect(data_collector.send(:should_be_enabled?)).to be false
+ expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be false
end
it "is disabled in solo-legacy with only a token" do
Chef::Config[:data_collector][:token] = "admit_one"
- expect(data_collector.send(:should_be_enabled?)).to be false
+ expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be false
end
it "is enabled in solo-legacy with both a token and url" do
Chef::Config[:data_collector][:server_url] = "https://www.esa.local/ariane5"
Chef::Config[:data_collector][:token] = "no_cash_value"
- expect(data_collector.send(:should_be_enabled?)).to be true
+ expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be true
end
it "is enabled in solo-legacy with only an output location to a file" do
Chef::Config[:data_collector][:output_locations] = { files: [ "/always/be/counting/down" ] }
- expect(data_collector.send(:should_be_enabled?)).to be true
+ expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be true
end
it "is disabled in solo-legacy with only an output location to a uri" do
Chef::Config[:data_collector][:output_locations] = { urls: [ "https://esa.local/ariane5" ] }
- expect(data_collector.send(:should_be_enabled?)).to be false
+ expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be false
end
it "is enabled in solo-legacy with only an output location to a uri with a token" do
Chef::Config[:data_collector][:output_locations] = { urls: [ "https://esa.local/ariane5" ] }
Chef::Config[:data_collector][:token] = "good_for_one_fare"
- expect(data_collector.send(:should_be_enabled?)).to be true
+ expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be true
end
it "is enabled in solo-legacy when the mode is :solo" do
Chef::Config[:data_collector][:server_url] = "https://www.esa.local/ariane5"
Chef::Config[:data_collector][:token] = "non_redeemable"
Chef::Config[:data_collector][:mode] = :solo
- expect(data_collector.send(:should_be_enabled?)).to be true
+ expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be true
end
it "is enabled in solo-legacy when the mode is :both" do
Chef::Config[:data_collector][:server_url] = "https://www.esa.local/ariane5"
Chef::Config[:data_collector][:token] = "non_negotiable"
Chef::Config[:data_collector][:mode] = :both
- expect(data_collector.send(:should_be_enabled?)).to be true
+ expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be true
end
it "is disabled in solo-legacy when the mode is :client" do
Chef::Config[:data_collector][:server_url] = "https://www.esa.local/ariane5"
Chef::Config[:data_collector][:token] = "NYCTA"
Chef::Config[:data_collector][:mode] = :client
- expect(data_collector.send(:should_be_enabled?)).to be false
+ expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be false
end
it "is disabled in solo-legacy mode when the mode is :nonsense" do
Chef::Config[:data_collector][:server_url] = "https://www.esa.local/ariane5"
Chef::Config[:data_collector][:token] = "MTA"
Chef::Config[:data_collector][:mode] = :nonsense
- expect(data_collector.send(:should_be_enabled?)).to be false
+ expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be false
end
end
it "by default it is enabled" do
- expect(data_collector.send(:should_be_enabled?)).to be true
+ expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be true
end
it "is disabled in why-run" do
Chef::Config[:why_run] = true
- expect(data_collector.send(:should_be_enabled?)).to be false
+ expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be false
end
describe "a solo legacy run" do
@@ -356,22 +356,22 @@ describe Chef::DataCollector do
it "is enabled in client mode when the mode is :both" do
Chef::Config[:data_collector][:mode] = :both
- expect(data_collector.send(:should_be_enabled?)).to be true
+ expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be true
end
it "is disabled in client mode when the mode is :solo" do
Chef::Config[:data_collector][:mode] = :solo
- expect(data_collector.send(:should_be_enabled?)).to be false
+ expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be false
end
it "is disabled in client mode when the mode is :nonsense" do
Chef::Config[:data_collector][:mode] = :nonsense
- expect(data_collector.send(:should_be_enabled?)).to be false
+ expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be false
end
it "is still enabled if you set a token in client mode" do
Chef::Config[:data_collector][:token] = "good_for_one_ride"
- expect(data_collector.send(:should_be_enabled?)).to be true
+ expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be true
end
end