Skip to content
This repository was archived by the owner on Jan 16, 2018. It is now read-only.
Closed
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: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ pkg/*
# YARD
.yardoc
yardoc/

test/example*
.ruby-*
2 changes: 1 addition & 1 deletion lib/simple_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def unset(key)
# @param [Symbol] The key to check.
# @return [Boolean] True if the key is set.
def exists?(key)
@settings.key?(key)
@settings.key?(key) || @groups.key?(key)
end

def set?(key)
Expand Down
7 changes: 6 additions & 1 deletion test/simple_config_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ def test_exists_should_return_whether_variable_isset
assert(@config.exists?(:foo))
@config.unset(:foo)
assert(!@config.exists?(:foo))
@config.group(:bats) do
set :foo, 'bar'
end
assert(@config.exists?(:bats))
assert(@config.bats.exists?(:foo))
end

def test_exists_should_consider_empty_values_as_set
Expand Down Expand Up @@ -103,7 +108,7 @@ def test_should_load_and_parse_external_config_as_ruby_in_context_of_config_inst
@config.load('external_config.rb')
end

def test_should_laod_and_parse_external_config_as_yaml_in_context_of_config_instance
def test_should_load_and_parse_external_config_as_yaml_in_context_of_config_instance
parser = stub('YAMLParser')
SimpleConfig::YAMLParser.stubs(:parse_contents_of_file).with('external_config.yml').returns(parser)
parser.expects(:parse_into).with(@config)
Expand Down