Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EY::Config should require yaml, but not #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/ey_config/local.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'fileutils'
require 'yaml'

module EY
class Config
Expand All @@ -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]
Expand Down
6 changes: 3 additions & 3 deletions spec/ey_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
end