summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorLamont Granquist <lamont@chef.io>2019-09-24 22:46:07 -0700
committerGitHub <noreply@github.com>2019-09-24 22:46:07 -0700
commit6827425d1563b4cf79847a154395eae737ab4909 (patch)
treeb7b54f43d968171b38ff857f0a0428459e8d0424 /spec
parentfc1ec86994aa00c39cd7a8acb52a6e02267bc885 (diff)
parentaaae16232cb1e17ac9b8060c3237f0bc6691e845 (diff)
downloadchef-6827425d1563b4cf79847a154395eae737ab4909.tar.gz
[Resource::remote_file] Fix show_progress in remote_file is cau… (#8904)
[Resource::remote_file] Fix show_progress in remote_file is causing FloatDomainError: Infinity
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/formatters/doc_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/unit/formatters/doc_spec.rb b/spec/unit/formatters/doc_spec.rb
index b8eccc1bc9..262276cfaa 100644
--- a/spec/unit/formatters/doc_spec.rb
+++ b/spec/unit/formatters/doc_spec.rb
@@ -76,6 +76,24 @@ describe Chef::Formatters::Base do
expect(formatter.pretty_elapsed_time).to include("10 hours 10 minutes 10 seconds")
end
+ it "shows nothing if total is nil" do
+ res = Chef::Resource::RemoteFile.new("canteloupe")
+ formatter.resource_update_progress(res, 35, nil, 10)
+ expect(out.string).to eq("")
+ end
+
+ it "shows nothing if total is 0" do
+ res = Chef::Resource::RemoteFile.new("canteloupe")
+ formatter.resource_update_progress(res, 35, 0, 10)
+ expect(out.string).to eq("")
+ end
+
+ it "shows nothing if current and total are 0" do
+ res = Chef::Resource::RemoteFile.new("canteloupe")
+ formatter.resource_update_progress(res, 0, 0, 10)
+ expect(out.string).to eq("")
+ end
+
it "shows the percentage completion of an action" do
res = Chef::Resource::RemoteFile.new("canteloupe")
formatter.resource_update_progress(res, 35, 50, 10)