diff --git a/lib/ey_config/local.rb b/lib/ey_config/local.rb index 20baaed..3ae982e 100644 --- a/lib/ey_config/local.rb +++ b/lib/ey_config/local.rb @@ -1,4 +1,5 @@ require 'fileutils' +require 'yaml' module EY class Config @@ -12,7 +13,7 @@ def generate(*args) contents = existing_contents contents = {} unless contents.is_a?(Hash) tmp = contents - + args[0 ... -1].each do |arg| tmp[arg] ||= {} tmp = tmp[arg] diff --git a/spec/ey_config_spec.rb b/spec/ey_config_spec.rb index 196e58b..207638c 100644 --- a/spec/ey_config_spec.rb +++ b/spec/ey_config_spec.rb @@ -37,7 +37,7 @@ def set_config_paths(first_config, second_config) end it "prevents accidentally modifying the config" do - lambda{ EY::Config.get(:some_app)["foo"] = "BADDATA" }.should raise_error TypeError + lambda{ EY::Config.get(:some_app)["foo"] = "BADDATA" }.should raise_error /can't modify frozen Hash/ end it "raises and warns for nonexistent keys" do @@ -114,6 +114,6 @@ def set_config_paths(first_config, second_config) EY::Config.config_path = first_config.path File.chmod(0333, first_config.path) - expect { EY::Config.init }.to raise_error + expect { EY::Config.init }.to raise_error end -end \ No newline at end of file +end