conker 0.14.1 → 0.14.2

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.
data/conker.gemspec CHANGED
@@ -2,7 +2,7 @@ Gem::Specification.new do |s|
2
2
  s.name = 'conker'
3
3
  s.authors = ['Sam Stokes', 'Conrad Irwin', 'Lee Mallabone', 'Martin Kleppmann']
4
4
  s.email = 'supportive@rapportive.com'
5
- s.version = '0.14.1'
5
+ s.version = '0.14.2'
6
6
  s.summary = %q{Conker will conquer your config.}
7
7
  s.description = "Configuration library."
8
8
  s.homepage = "https://github.com/rapportive/conker"
data/lib/conker.rb CHANGED
@@ -276,7 +276,7 @@ module Conker
276
276
  unless value.is_a? Hash
277
277
  raise IncompatibleType, "wanted a Hash, got #{value.class}"
278
278
  end
279
- value
279
+ value.with_indifferent_access
280
280
  else
281
281
  raise UnknownType, type.to_s
282
282
  end
@@ -0,0 +1,4 @@
1
+ CERTIFICATES:
2
+ :foobar1: 'a'
3
+ foobar2: 'b'
4
+ 'foobar3': 'c'
@@ -7,6 +7,10 @@ describe Conker do
7
7
  @constants = Kernel.constants
8
8
  end
9
9
 
10
+ def fixture(filename)
11
+ File.join(File.dirname(__FILE__), '..', 'fixtures', filename)
12
+ end
13
+
10
14
  after :each do
11
15
  # Don't need to worry about changing (rather than adding) constants,
12
16
  # because Ruby will whinge if we do that.
@@ -45,6 +49,31 @@ describe Conker do
45
49
  end
46
50
  end
47
51
 
52
+ describe 'type: :hash' do
53
+ before do
54
+ fixture_path = fixture('hash.yml')
55
+ Conker.module_eval do
56
+ setup_config! :development, fixture_path,
57
+ CERTIFICATES: optional(type: :hash, default: {})
58
+ end
59
+ end
60
+
61
+ it 'should allow indifferent access to symbols' do
62
+ ::CERTIFICATES[:foobar1].should == 'a'
63
+ ::CERTIFICATES['foobar1'].should == 'a'
64
+ end
65
+
66
+ it 'should allow indifferent access to strings' do
67
+ ::CERTIFICATES[:foobar2].should == 'b'
68
+ ::CERTIFICATES['foobar2'].should == 'b'
69
+ end
70
+
71
+ it 'should allow indifferent access to string that look like symbols' do
72
+ ::CERTIFICATES[:foobar3].should == 'c'
73
+ ::CERTIFICATES['foobar3'].should == 'c'
74
+ end
75
+ end
76
+
48
77
  describe 'reading config from a hash' do
49
78
  describe 'basic usage' do
50
79
  def setup!(env = :development, config = {})
@@ -305,10 +334,6 @@ describe Conker do
305
334
 
306
335
 
307
336
  describe 'reading config from a YAML file' do
308
- def fixture(filename)
309
- File.join(File.dirname(__FILE__), '..', 'fixtures', filename)
310
- end
311
-
312
337
  describe 'basic usage' do
313
338
  def setup!(env = :development, filename = 'empty.yml')
314
339
  fixture_path = fixture(filename)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.1
4
+ version: 0.14.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2013-09-28 00:00:00.000000000 Z
15
+ date: 2013-10-02 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: activesupport
@@ -76,6 +76,7 @@ files:
76
76
  - lib/conker.rb
77
77
  - open-source-TODO.txt
78
78
  - spec/fixtures/empty.yml
79
+ - spec/fixtures/hash.yml
79
80
  - spec/fixtures/port_3000.yml
80
81
  - spec/lib/conker_spec.rb
81
82
  homepage: https://github.com/rapportive/conker