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 +4 -4
- data/lib/duranged/base.rb +2 -0
- data/lib/duranged/version.rb +1 -1
- data/spec/shared/base_examples.rb +12 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31e3fcac50038ae20afc3ecb31d1a68463289e4c
|
4
|
+
data.tar.gz: ce4b9debd31dc782ecc35a5a009204199f63884f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 09d84f0f8be5452ecb21d59cea7c342f13b4fc0f0087d6a6e2b56bc84dba388474641400a3903e97a987e622be2286e780e768d2932f96dfdae9c65134a9c090
|
7
|
+
data.tar.gz: 36827805a870a1e40a22e9edd46a45054c099b1e3db9f9f29824cefe442adeb3bebd83aec8085b94bfb3470aafc65cd3c88d4ea64032339bb4084b2227f6fd50
|
data/lib/duranged/base.rb
CHANGED
data/lib/duranged/version.rb
CHANGED
@@ -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!.
|
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!.
|
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!.
|
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!.
|
245
|
+
expect(subject.round_to_hours!.value).to eq 1.hour
|
238
246
|
end
|
239
247
|
end
|
240
248
|
end
|