progressrus 0.1.3 → 0.1.4

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: 9ca998950cc1e1b880214a9605023ee0c07a0740
4
- data.tar.gz: d63aed50c28c99835aedcf56d582cd192a180f84
3
+ metadata.gz: 1352b1b5be4da5d8a7132c00e12f05fe2433116e
4
+ data.tar.gz: 606d4001ebd436afae0bff0ef4befd07611092f1
5
5
  SHA512:
6
- metadata.gz: c1dccbf3c8dc1b33a65bfd315b0baf7114c394f86aac15e9dca41a12ac255cb3f31553cf95aaf377d8c7d02474ba2f013bf4630a177f051ee1a1e5d7f62b6c07
7
- data.tar.gz: 7368475285d010d622e87361cccb7509b9c7e038eccebe15e0915b4ab1fa5ebf697d1b925de88cdd4c38a1382c8c7f4a7cdcf419dc6d95ae2c82c776e8d8f1d2
6
+ metadata.gz: 610f86165a43ef101fc08c0eb9731de7e593a424abeafc476020c54b10d6e440c9c2c06e3e0f9d44f1a1689bb1380829c2fe967e16feaadc9f29275f3e2002e7
7
+ data.tar.gz: 1c69902b01e52a338fddc004881ce570d582af69c6f03d4ad821e3ca829658419a10e519efca5df0f8ca379284cd90ae89b01cdafd8ea8e70ad95f8d22d1d8e5
data/.gitignore CHANGED
@@ -16,3 +16,4 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
  vendor/
19
+ .ruby-version
@@ -127,10 +127,6 @@ class Progressrus
127
127
  @total
128
128
  end
129
129
 
130
- def total
131
- @total ||= 1
132
- end
133
-
134
130
  def elapsed(now: Time.now)
135
131
  now - started_at
136
132
  end
@@ -1,3 +1,3 @@
1
1
  class Progressrus
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -70,4 +70,12 @@ class IntegrationTest < Minitest::Test
70
70
  assert_equal 0, ticks.first.count
71
71
  assert_instance_of Time, ticks.first.failed_at
72
72
  end
73
+
74
+ def test_unknown_count
75
+ progress = Progressrus.new(id: "omg", scope: ["walrus"], total: nil)
76
+ progress.tick
77
+
78
+ progress = Progressrus.find(["walrus"], "omg")
79
+ assert_nil progress.total
80
+ end
73
81
  end
@@ -40,7 +40,7 @@ class ProgressrusTest < Minitest::Test
40
40
 
41
41
  def test_initialize_with_persist
42
42
  Progressrus.any_instance.expects(:persist).with(force: true).once
43
- progressrus = Progressrus.new(persist: true)
43
+ Progressrus.new(persist: true)
44
44
  end
45
45
 
46
46
  def test_tick_should_set_started_at_if_not_already_set_and_tick_greater_than_zero
@@ -81,7 +81,7 @@ class ProgressrusTest < Minitest::Test
81
81
 
82
82
  def test_eta_should_return_nil_if_no_count
83
83
  progress = Progressrus.new
84
- assert_equal nil, progress.eta
84
+ assert_nil progress.eta
85
85
  end
86
86
 
87
87
  def test_eta_should_return_time_in_future_based_on_time_elapsed
@@ -132,12 +132,9 @@ class ProgressrusTest < Minitest::Test
132
132
 
133
133
  def test_to_serializeable_set_total_to_1_if_no_total
134
134
  @progress.instance_variable_set(:@total, nil)
135
- assert_equal 1, @progress.to_serializeable[:total]
136
- end
137
135
 
138
- def test_total_when_total_is_nil_is_1
139
- @progress.instance_variable_set(:@total, nil)
140
- assert_equal 1, @progress.total
136
+ assert @progress.to_serializeable.key?(:total)
137
+ assert_nil @progress.to_serializeable[:total]
141
138
  end
142
139
 
143
140
  def test_to_serializeable_should_return_a_hash_of_options
@@ -60,7 +60,7 @@ class RedisStoreTest < Minitest::Test
60
60
  end
61
61
 
62
62
  def test_find_should_return_nil_if_nothing_is_found
63
- assert_equal nil, @store.find(@scope, 'oemg')
63
+ assert_nil @store.find(@scope, 'oemg')
64
64
  end
65
65
 
66
66
  def test_flush_should_delete_by_scope
@@ -78,7 +78,7 @@ class RedisStoreTest < Minitest::Test
78
78
 
79
79
  @store.flush(@scope, 'oemg')
80
80
 
81
- assert_equal nil, @store.find(@scope, 'oemg')
81
+ assert_nil @store.find(@scope, 'oemg')
82
82
  assert @store.find(@scope, 'oemg-two')
83
83
  end
84
84
 
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.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Eskildsen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-20 00:00:00.000000000 Z
11
+ date: 2018-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis