hashr 2.0.0 → 2.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/hashr/env.rb +2 -0
- data/lib/hashr/version.rb +1 -1
- data/spec/hashr/env_spec.rb +42 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d8704f86e52725690deaf8d11039316590fc32a
|
4
|
+
data.tar.gz: c0702f80dad1588deb39e4edc26738975d6d6bde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d69e6ca9d3f9029f4c9f94cc26712a857de862daec959096bb0d872ee6cc80a52dba75a701db7f2e24fda905741ae3d8843b5ff15d25067cf60b97025491c9aa
|
7
|
+
data.tar.gz: b11b4afa18dcca79d517b2f4e67414b23e4177efaee84472966caa5dd10c7bc9ad1ffac6fa3ce5df93649ed4668fbf030507f10c3fa0dc85c47d0932dfcc9a2b
|
data/lib/hashr/env.rb
CHANGED
data/lib/hashr/version.rb
CHANGED
data/spec/hashr/env_spec.rb
CHANGED
@@ -8,7 +8,9 @@ describe Hashr::Env do
|
|
8
8
|
define string: 'string',
|
9
9
|
hash: { key: 'value' },
|
10
10
|
array: ['foo', 'bar'],
|
11
|
-
bool: false
|
11
|
+
bool: false,
|
12
|
+
int: 4,
|
13
|
+
float: 11.1
|
12
14
|
end
|
13
15
|
end
|
14
16
|
|
@@ -55,6 +57,45 @@ describe Hashr::Env do
|
|
55
57
|
expect(klass.new.array).to eq([])
|
56
58
|
end
|
57
59
|
end
|
60
|
+
|
61
|
+
describe 'to an int' do
|
62
|
+
it 'int given' do
|
63
|
+
ENV['HASHR_INT'] = '1'
|
64
|
+
expect(klass.new.int).to eq(1)
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'errors for an empty string' do
|
68
|
+
ENV['HASHR_INT'] = ''
|
69
|
+
expect { klass.new.int }.to raise_error(ArgumentError)
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'errors for a non-int' do
|
73
|
+
ENV['HASHR_INT'] = 'a'
|
74
|
+
expect { klass.new.int }.to raise_error(ArgumentError)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
describe 'to a float' do
|
79
|
+
it 'float given' do
|
80
|
+
ENV['HASHR_FLOAT'] = '2.3'
|
81
|
+
expect(klass.new.float).to eq(2.3)
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'int given' do
|
85
|
+
ENV['HASHR_FLOAT'] = '4'
|
86
|
+
expect(klass.new.float).to eq(4.0)
|
87
|
+
end
|
88
|
+
|
89
|
+
it 'errors for an empty string' do
|
90
|
+
ENV['HASHR_FLOAT'] = ''
|
91
|
+
expect { klass.new.float }.to raise_error(ArgumentError)
|
92
|
+
end
|
93
|
+
|
94
|
+
it 'errors for a non-float' do
|
95
|
+
ENV['HASHR_FLOAT'] = 'a'
|
96
|
+
expect { klass.new.float }.to raise_error(ArgumentError)
|
97
|
+
end
|
98
|
+
end
|
58
99
|
end
|
59
100
|
|
60
101
|
it 'data takes precedence over an env var' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hashr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sven Fuchs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Simple Hash extension to make working with nested hashes (e.g. for configuration)
|
14
14
|
easier and less error-prone.
|
@@ -50,10 +50,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
50
50
|
version: '0'
|
51
51
|
requirements: []
|
52
52
|
rubyforge_project: "[none]"
|
53
|
-
rubygems_version: 2.
|
53
|
+
rubygems_version: 2.6.8
|
54
54
|
signing_key:
|
55
55
|
specification_version: 4
|
56
56
|
summary: Simple Hash extension to make working with nested hashes (e.g. for configuration)
|
57
57
|
easier and less error-prone
|
58
58
|
test_files: []
|
59
|
-
has_rdoc:
|