Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix exeption when dbmanager.yml is empty

  • Loading branch information...
commit 00b26cde79785e53f22e2a1180e5621533396194 1 parent eac8307
@spaghetticode authored
View
4 CHANGELOG.md
@@ -1,3 +1,7 @@
+## v0.0.5
+
+* remove exception when dbmanager.yml is empty
+
## v0.0.4
* bugfixes
View
2  lib/dbmanager/version.rb
@@ -1,3 +1,3 @@
module Dbmanager
- VERSION = "0.0.4"
+ VERSION = "0.0.5"
end
View
2  lib/dbmanager/yml_parser.rb
@@ -36,7 +36,7 @@ def environments
private
def yml_load(path)
- YAML.load ERB.new(File.read(path)).result
+ YAML.load(ERB.new(File.read(path)).result) || {}
end
def db_config_file
View
25 spec/lib/yml_parser_spec.rb
@@ -39,17 +39,26 @@ module Dbmanager
end
context 'when there is a dbmanager_override file' do
- it 'overrides regular settings' do
- YmlParser.config['beta']['host'].should == '345.345.345.345'
+ context 'whe the file is empty' do
+ it 'doesnt raise any error' do
+ YAML.stub!(:load => nil)
+ expect { YmlParser.config }.to_not raise_error
+ end
end
- it 'removes old unchanged settings' do
- YmlParser.config['beta']['username'].should == 'beta_username'
- end
+ context 'when the file is populated' do
+ it 'overrides regular settings' do
+ YmlParser.config['beta']['host'].should == '345.345.345.345'
+ end
+
+ it 'removes old unchanged settings' do
+ YmlParser.config['beta']['username'].should == 'beta_username'
+ end
- context 'when the environment has a ignoretables directive' do
- it 'should populate ignoretables with the expected array' do
- YmlParser.config['beta']['ignoretables'].should == ['view0']
+ context 'when the environment has a ignoretables directive' do
+ it 'should populate ignoretables with the expected array' do
+ YmlParser.config['beta']['ignoretables'].should == ['view0']
+ end
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.