summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorJoel Handwell <joelhandwell@gmail.com>2015-08-31 08:31:55 -0400
committerJoel Handwell <joelhandwell@gmail.com>2015-09-02 07:55:25 -0400
commit850bded619ac14e62bed15b85cc34d6ef3b99202 (patch)
tree10d83b6d47ef92439d00ce42733ee6fce9a6b71a /spec
parent5f6589f3c05c965d3c555613bf21c635978a36be (diff)
downloadchef-850bded619ac14e62bed15b85cc34d6ef3b99202.tar.gz
Keep elapsed_time and add pretty_elapsed_time
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/formatters/doc_spec.rb15
1 files changed, 9 insertions, 6 deletions
diff --git a/spec/unit/formatters/doc_spec.rb b/spec/unit/formatters/doc_spec.rb
index 15af595020..7db5ebc348 100644
--- a/spec/unit/formatters/doc_spec.rb
+++ b/spec/unit/formatters/doc_spec.rb
@@ -61,24 +61,27 @@ describe Chef::Formatters::Base do
it "prints only seconds when elapsed time is less than 60 seconds" do
Timecop.freeze(2008, 9, 9, 9, 9, 19) do
formatter.run_completed(nil)
- expect(formatter.elapsed_time).to include("10 seconds")
- expect(formatter.elapsed_time).not_to include("minutes")
- expect(formatter.elapsed_time).not_to include("hours")
+ expect(formatter.elapsed_time).to eql(10.0)
+ expect(formatter.pretty_elapsed_time).to include("10 seconds")
+ expect(formatter.pretty_elapsed_time).not_to include("minutes")
+ expect(formatter.pretty_elapsed_time).not_to include("hours")
end
end
it "prints minutes and seconds when elapsed time is more than 60 seconds" do
Timecop.freeze(2008, 9, 9, 9, 19, 19) do
formatter.run_completed(nil)
- expect(formatter.elapsed_time).to include("10 minutes 10 seconds")
- expect(formatter.elapsed_time).not_to include("hours")
+ expect(formatter.elapsed_time).to eql(610.0)
+ expect(formatter.pretty_elapsed_time).to include("10 minutes 10 seconds")
+ expect(formatter.pretty_elapsed_time).not_to include("hours")
end
end
it "prints hours, minutes and seconds when elapsed time is more than 3600 seconds" do
Timecop.freeze(2008, 9, 9, 19, 19, 19) do
formatter.run_completed(nil)
- expect(formatter.elapsed_time).to include("10 hours 10 minutes 10 seconds")
+ expect(formatter.elapsed_time).to eql(36610.0)
+ expect(formatter.pretty_elapsed_time).to include("10 hours 10 minutes 10 seconds")
end
end
end