samwise 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/samwise/util.rb +2 -2
- data/lib/samwise/version.rb +1 -1
- data/spec/util_spec.rb +7 -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: 0bed49cb7a81e9e2d2375bd9de92743a11df4eae
|
4
|
+
data.tar.gz: 927992dce573abe901c4e40175840d36f244539a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a4650866ec374da143ed0a390547cadf0b893182ff20f4076861d46ed1d4615201ed658da0f6c850df1c8e88f0c35177f75c20b468900069c73c919ab1e3a2c
|
7
|
+
data.tar.gz: 376870f9b72e13188e700df1213b256908737ae3df3c8c04e193296923fc51f0a21662f47a2c2d760c52124752511fd80967d4b0f60178dcc7b3ef74dd61c27c
|
data/lib/samwise/util.rb
CHANGED
@@ -5,7 +5,7 @@ module Samwise
|
|
5
5
|
def self.duns_is_properly_formatted?(duns: nil)
|
6
6
|
return false if duns.nil?
|
7
7
|
|
8
|
-
duns.gsub
|
8
|
+
duns = duns.gsub('-', '')
|
9
9
|
|
10
10
|
return true if duns_contains_forbidden_characters?(duns: duns)
|
11
11
|
|
@@ -19,7 +19,7 @@ module Samwise
|
|
19
19
|
def self.format_duns(duns: nil)
|
20
20
|
raise Samwise::Error::InvalidFormat unless duns_is_properly_formatted?(duns: duns)
|
21
21
|
|
22
|
-
duns.gsub
|
22
|
+
duns = duns.gsub('-', '')
|
23
23
|
|
24
24
|
if duns_is_nine_digits?(duns: duns)
|
25
25
|
duns = "#{duns}0000"
|
data/lib/samwise/version.rb
CHANGED
data/spec/util_spec.rb
CHANGED
@@ -60,6 +60,13 @@ describe Samwise::Util do
|
|
60
60
|
end
|
61
61
|
|
62
62
|
context '#format_duns' do
|
63
|
+
it 'should not suffer from mutability side effects' do
|
64
|
+
duns_copy = hyphen_duns.dup
|
65
|
+
Samwise::Util.format_duns(duns: hyphen_duns)
|
66
|
+
|
67
|
+
expect(hyphen_duns).to eq(duns_copy)
|
68
|
+
end
|
69
|
+
|
63
70
|
it 'should format an 8 digit DUNS into a 13 digit DUNS' do
|
64
71
|
formatted_duns = Samwise::Util.format_duns(duns: eight_duns)
|
65
72
|
|