summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-06-18 09:35:57 -0700
committerGitHub <noreply@github.com>2020-06-18 09:35:57 -0700
commit3e158ac5df0c1330d671a3aaf7298b2664d62102 (patch)
tree3842a5b5b19a1f4b5714340d78808959a94279ab
parente89b82b3028ea1d2b0591c20297f03ec2d818537 (diff)
parent04546d592e05170c8756d0aa770acba8e0cbd598 (diff)
downloadchef-3e158ac5df0c1330d671a3aaf7298b2664d62102.tar.gz
Merge pull request #10015 from ramereth/chef-15_fix-chef-apply-enforce_license
Fix how enforce_license is set in run method for chef-apply
-rw-r--r--lib/chef/application/apply.rb2
-rw-r--r--spec/unit/application_spec.rb7
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/chef/application/apply.rb b/lib/chef/application/apply.rb
index 6469e9b532..c858e02eda 100644
--- a/lib/chef/application/apply.rb
+++ b/lib/chef/application/apply.rb
@@ -216,7 +216,7 @@ class Chef::Application::Apply < Chef::Application
end
# Get this party started
- def run(enforce_license = false)
+ def run(enforce_license: false)
reconfigure
check_license_acceptance if enforce_license
run_application
diff --git a/spec/unit/application_spec.rb b/spec/unit/application_spec.rb
index f5800e61a9..655c98bef6 100644
--- a/spec/unit/application_spec.rb
+++ b/spec/unit/application_spec.rb
@@ -94,6 +94,13 @@ describe Chef::Application do
end
end
+ describe "when enforce_license is set to false" do
+ it "should not check the license acceptance" do
+ expect(@app).to_not receive(:check_license_acceptance)
+ @app.run(enforce_license: false)
+ end
+ end
+
it "should run the actual application" do
expect(@app).to receive(:run_application).and_return(true)
@app.run