codelocks 1.0.0 → 1.0.1
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/codelocks/net_code.rb +7 -7
- data/lib/codelocks/version.rb +1 -1
- data/spec/codelocks/net_code_spec.rb +13 -0
- 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: 22a32b897d94688bf6f6a455987b58f0c05d251c
|
4
|
+
data.tar.gz: 7c58c530ddc5ea411222c82d0f66b95e286b3e51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8860b06e8c2b86a4a5f388b3e9d57a9ffb5b8ea2de4e36ec897f5f793a019d9a9ca05d9cfb8129c010a1dbd9df4ac4035d3c27bcff34d410c6dacbccd4e1ace
|
7
|
+
data.tar.gz: 6ac150201dfc62c9cefc77a88dd8bab938b0405c63cc28f7b66436bf66a540240768553842e2c11ced71a20c04bfb34891fb8d3219b77c4d4c48e6386ce07fa9
|
data/lib/codelocks/net_code.rb
CHANGED
@@ -32,19 +32,19 @@ module Codelocks
|
|
32
32
|
duration
|
33
33
|
when duration <= 12 # less than 13 hours
|
34
34
|
duration -1
|
35
|
-
when 13..24.include?(duration) # 1 day
|
35
|
+
when (13..24).include?(duration) # 1 day
|
36
36
|
12
|
37
|
-
when 25..48.include?(duration) # 2 days
|
37
|
+
when (25..48).include?(duration) # 2 days
|
38
38
|
13
|
39
|
-
when 49..72.include?(duration) # 3 days
|
39
|
+
when (49..72).include?(duration) # 3 days
|
40
40
|
14
|
41
|
-
when 73..96.include?(duration) # 4 days
|
41
|
+
when (73..96).include?(duration) # 4 days
|
42
42
|
15
|
43
|
-
when 97..120.include?(duration) # 5 days
|
43
|
+
when (97..120).include?(duration) # 5 days
|
44
44
|
16
|
45
|
-
when 121..144.include?(duration) # 6 days
|
45
|
+
when (121..144).include?(duration) # 6 days
|
46
46
|
17
|
47
|
-
when 145..168.include?(duration) # 7 days
|
47
|
+
when (145..168).include?(duration) # 7 days
|
48
48
|
18
|
49
49
|
when duration > 168 # more than 7 days, generates a URM code
|
50
50
|
19
|
data/lib/codelocks/version.rb
CHANGED
@@ -61,4 +61,17 @@ describe Codelocks::NetCode do
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
64
|
+
|
65
|
+
describe '#convert_duration' do
|
66
|
+
subject { Codelocks::NetCode.send(:convert_duration, duration) }
|
67
|
+
let(:duration) { rand(0..1000) }
|
68
|
+
|
69
|
+
it "doesn't return an error" do
|
70
|
+
expect { subject }.not_to raise_error
|
71
|
+
end
|
72
|
+
|
73
|
+
it "returns an integer" do
|
74
|
+
expect(subject).to be_a(Integer)
|
75
|
+
end
|
76
|
+
end
|
64
77
|
end
|