isomer 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -75,7 +75,7 @@ You can also specify a number of parameters:
75
75
  #### Options
76
76
 
77
77
  * `file`: Path to the YAML file (required)
78
- * `root`: If there are multiple configurations (eg. for different environments), you can specify which one to use
78
+ * `base`: If there are multiple configurations (eg. for different environments), you can specify which one to use
79
79
  * `required`: If the configuration file is required
80
80
 
81
81
 
@@ -21,6 +21,8 @@ class Isomer::Sources::Yaml < Isomer::Sources::Base
21
21
  else
22
22
  @configuration = values
23
23
  end
24
+
25
+ @configuration ||= {}
24
26
  else
25
27
  raise Isomer::Error, "Missing required configuration file '#{file}'" if required
26
28
  @configuration = {}
@@ -1,3 +1,3 @@
1
1
  module Isomer
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -25,6 +25,16 @@ describe Isomer::Sources::Yaml do
25
25
  source.configuration.should == {'foo' => 'bar'}
26
26
  end
27
27
 
28
+ it 'returns an empty hash if the content is nil' do
29
+ File.stub(:exists?).and_return(true)
30
+ YAML.stub(:load_file).and_return(nil)
31
+
32
+ source = Isomer::Sources::Yaml.new(anything, file: 'anything.yml')
33
+ source.load
34
+
35
+ source.configuration.should == {}
36
+ end
37
+
28
38
  context 'when the file does not exist' do
29
39
  context 'when it is not required' do
30
40
  it 'does not blow up' do
@@ -59,6 +69,16 @@ describe Isomer::Sources::Yaml do
59
69
 
60
70
  source.configuration.should == {'limit' => 100}
61
71
  end
72
+
73
+ it 'returns an empty hash if the content is nil' do
74
+ File.stub(:exists?).and_return(true)
75
+ YAML.stub(:load_file).and_return( 'production' => nil )
76
+
77
+ source = Isomer::Sources::Yaml.new(anything, file: 'filish.yml', base: 'production')
78
+ source.load
79
+
80
+ source.configuration.should == {}
81
+ end
62
82
  end
63
83
  end
64
84
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isomer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-09 00:00:00.000000000 Z
12
+ date: 2013-08-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -107,7 +107,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
107
107
  version: '0'
108
108
  segments:
109
109
  - 0
110
- hash: 2110058437799830098
110
+ hash: 2295132044477336041
111
111
  required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  none: false
113
113
  requirements:
@@ -116,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  version: '0'
117
117
  segments:
118
118
  - 0
119
- hash: 2110058437799830098
119
+ hash: 2295132044477336041
120
120
  requirements: []
121
121
  rubyforge_project:
122
122
  rubygems_version: 1.8.25