local_ci 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/local_ci/output.rb +3 -3
- data/local_ci.gemspec +1 -1
- data/spec/unit/local_ci/output_spec.rb +9 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 325240cf896966e5fe98d945c9485e3f4b30a32db4762d77f5c3e97664e3f7b1
|
|
4
|
+
data.tar.gz: dc2630284356e1ba3a7f22f97107d7c429f423daf2a0e64835b6803e7c935aef
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bcbcbe5912235021b56063ebe5b94bf09af69d82aaba2da3b378af1c7c98bf779d684db9eb301c99e231a0af7bf38f5fef69c359bfd82d9aa4b7dc90858851eb
|
|
7
|
+
data.tar.gz: b23429e6de91524c432b99951a1e060cfaaa0de32be800591f1020a44f4d1c7aca7db5fd317b2cf6aaccb4517eb59a24c37c73a85a28f6f5e846a88a4fc73443
|
data/lib/local_ci/output.rb
CHANGED
|
@@ -116,7 +116,7 @@ module LocalCI
|
|
|
116
116
|
|
|
117
117
|
def duration
|
|
118
118
|
seconds = Time.now - @start
|
|
119
|
-
minutes = seconds / 60
|
|
119
|
+
minutes = (seconds / 60).to_i
|
|
120
120
|
hours = minutes / 60
|
|
121
121
|
|
|
122
122
|
seconds %= 60
|
|
@@ -126,10 +126,10 @@ module LocalCI
|
|
|
126
126
|
"#{hours}h #{minutes}m"
|
|
127
127
|
|
|
128
128
|
elsif minutes >= 1
|
|
129
|
-
"#{minutes}m #{seconds}s"
|
|
129
|
+
"#{minutes}m #{seconds.floor}s"
|
|
130
130
|
|
|
131
131
|
else
|
|
132
|
-
"
|
|
132
|
+
"%.2fs" % seconds
|
|
133
133
|
end
|
|
134
134
|
end
|
|
135
135
|
|
data/local_ci.gemspec
CHANGED
|
@@ -362,12 +362,19 @@ describe LocalCI::Output do
|
|
|
362
362
|
|
|
363
363
|
expect(@output.duration).to eq("39.43s")
|
|
364
364
|
end
|
|
365
|
+
|
|
366
|
+
it "shows seconds with two decimal places even if it's exactly a second" do
|
|
367
|
+
@output.instance_variable_set(:@start, 5.0)
|
|
368
|
+
allow(Time).to receive(:now).and_return(45)
|
|
369
|
+
|
|
370
|
+
expect(@output.duration).to eq("40.00s")
|
|
371
|
+
end
|
|
365
372
|
end
|
|
366
373
|
|
|
367
374
|
context "when less than 60 minutes" do
|
|
368
375
|
it "shows the minutes and seconds" do
|
|
369
376
|
@output.instance_variable_set(:@start, 10)
|
|
370
|
-
allow(Time).to receive(:now).and_return(1240)
|
|
377
|
+
allow(Time).to receive(:now).and_return(1240.1)
|
|
371
378
|
|
|
372
379
|
expect(@output.duration).to eq("20m 30s")
|
|
373
380
|
end
|
|
@@ -376,7 +383,7 @@ describe LocalCI::Output do
|
|
|
376
383
|
context "when greater than 60 minutes" do
|
|
377
384
|
it "shows the hours and minutes" do
|
|
378
385
|
@output.instance_variable_set(:@start, 10)
|
|
379
|
-
allow(Time).to receive(:now).and_return(3800)
|
|
386
|
+
allow(Time).to receive(:now).and_return(3800.1)
|
|
380
387
|
|
|
381
388
|
expect(@output.duration).to eq("1h 3m")
|
|
382
389
|
end
|