duranged 0.0.4 → 0.0.5

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: 7c23f324a8e86d2f5e42df7cb8c50a3904c94426
4
- data.tar.gz: f6f8d5f74d185b9df4d106b7314bfe557b03500c
3
+ metadata.gz: 31e3fcac50038ae20afc3ecb31d1a68463289e4c
4
+ data.tar.gz: ce4b9debd31dc782ecc35a5a009204199f63884f
5
5
  SHA512:
6
- metadata.gz: 3dc3189de912615bf2c52ff4b30ead77597ef018e9ca538079d9ed2560705f1fb2827ea213ff2371e535fbe12b736218ac1aaa9446341c134e080f62c20e612d
7
- data.tar.gz: 440b452fbdcd97aa51a1b195f1c5fac6e6d6ce26e7cedabc8799de6bcfe853774bc02773b1e757c31a5984daaa09c5a1d80afc452c737a0458cb41fe1f065524
6
+ metadata.gz: 09d84f0f8be5452ecb21d59cea7c342f13b4fc0f0087d6a6e2b56bc84dba388474641400a3903e97a987e622be2286e780e768d2932f96dfdae9c65134a9c090
7
+ data.tar.gz: 36827805a870a1e40a22e9edd46a45054c099b1e3db9f9f29824cefe442adeb3bebd83aec8085b94bfb3470aafc65cd3c88d4ea64032339bb4084b2227f6fd50
@@ -66,6 +66,7 @@ module Duranged
66
66
  else
67
67
  @value = value - seconds
68
68
  end
69
+ self
69
70
  end
70
71
 
71
72
  def round_to_hours
@@ -79,6 +80,7 @@ module Duranged
79
80
  else
80
81
  @value = value - minutes.minutes
81
82
  end
83
+ self
82
84
  end
83
85
 
84
86
  protected
@@ -1,3 +1,3 @@
1
1
  module Duranged
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -204,11 +204,15 @@ RSpec.shared_examples "the base class" do |klass|
204
204
  end
205
205
 
206
206
  describe '#round_to_minutes!' do
207
+ it 'returns self' do
208
+ expect(subject.round_to_minutes!).to eq subject
209
+ end
210
+
207
211
  context 'when seconds is >= 30' do
208
212
  subject { klass.new(3630.seconds) }
209
213
 
210
214
  it 'rounds up to the next minute' do
211
- expect(subject.round_to_minutes!.to_i).to eq 3660
215
+ expect(subject.round_to_minutes!.value).to eq 3660
212
216
  end
213
217
  end
214
218
 
@@ -216,17 +220,21 @@ RSpec.shared_examples "the base class" do |klass|
216
220
  subject { klass.new(3620.seconds) }
217
221
 
218
222
  it 'rounds down to the minute' do
219
- expect(subject.round_to_minutes!.to_i).to eq 3600
223
+ expect(subject.round_to_minutes!.value).to eq 3600
220
224
  end
221
225
  end
222
226
  end
223
227
 
224
228
  describe '#round_to_hours!' do
229
+ it 'returns self' do
230
+ expect(subject.round_to_hours!).to eq subject
231
+ end
232
+
225
233
  context 'when minutes is >= 30' do
226
234
  subject { klass.new(90.minutes) }
227
235
 
228
236
  it 'rounds up to the next hour' do
229
- expect(subject.round_to_hours!.to_i).to eq 2.hours
237
+ expect(subject.round_to_hours!.value).to eq 2.hours
230
238
  end
231
239
  end
232
240
 
@@ -234,7 +242,7 @@ RSpec.shared_examples "the base class" do |klass|
234
242
  subject { klass.new(80.minutes) }
235
243
 
236
244
  it 'rounds down to the hour' do
237
- expect(subject.round_to_hours!.to_i).to eq 1.hour
245
+ expect(subject.round_to_hours!.value).to eq 1.hour
238
246
  end
239
247
  end
240
248
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: duranged
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Rebec