progressrus 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b555645f6b93b11a5d62bb4231b4bd6b099fea6e
4
- data.tar.gz: 776d5d3c6582898dd5b4133c23c715f084ef3f5d
3
+ metadata.gz: a654e74220bfd54eb96f2c18390e8fcc794ae937
4
+ data.tar.gz: db38bb7f163a7ef1d2cca42fde38a644464e0316
5
5
  SHA512:
6
- metadata.gz: e147bf227e40735e32136fe8d75a7238c1e103b779cbc62260e2175637d47325d52517026cb1bb303bc50464cf8e64c37aad5ab6d7ecff98cbc51d3e68c9eb71
7
- data.tar.gz: def1af6f771ba9341adc465a3bff7688eb6e4fb74a98fd85eacde1dd484b3bc38013906e4eeb4cd23966ff58a0c0288ec279f544872e9d9027f9b56214d09fcb
6
+ metadata.gz: 80adef7173fa11523e3ea323333d8b4dd50cfdc9b88c41dc85ba718b9c2b5f0e25a97086f9e0e552e9b1878ac4c0e07aefd20e8d9370ca7ffe0f776d7d78a5b1
7
+ data.tar.gz: 2a4bdbef69f9f31d8675f922ff73d02325c1732d8fb24823b12b6765ca1451cb6f0176af7c45e08b817663d1fa65e613951300480a88941f2818fb045863cc08
@@ -1,3 +1,3 @@
1
1
  class Progressrus
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
data/lib/progressrus.rb CHANGED
@@ -132,6 +132,8 @@ class Progressrus
132
132
  end
133
133
 
134
134
  def percentage
135
+ return unless total
136
+
135
137
  if total > 0
136
138
  count.to_f / total
137
139
  else
@@ -78,5 +78,6 @@ class IntegrationTest < Minitest::Test
78
78
  progress = Progressrus.find(["walrus"], "omg")
79
79
  assert_nil progress.total
80
80
  assert_nil progress.eta
81
+ assert_nil progress.percentage
81
82
  end
82
83
  end
@@ -119,6 +119,13 @@ class ProgressrusTest < Minitest::Test
119
119
  assert_equal 0, @progress.percentage
120
120
  end
121
121
 
122
+ def test_percentage_should_be_nil_if_total_nil
123
+ progress = Progressrus.new(total: nil)
124
+ assert_nil progress.percentage
125
+ progress.tick
126
+ assert_nil progress.percentage
127
+ end
128
+
122
129
  def test_percentage_should_be_1_if_total_0
123
130
  progress = Progressrus.new(total: 0)
124
131
  assert_equal 1, progress.percentage
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: progressrus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Eskildsen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-26 00:00:00.000000000 Z
11
+ date: 2018-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis