Skip to content

Commit

Permalink
Merge pull request #134 from josh-barker/merged_config_empty
Browse files Browse the repository at this point in the history
Add empty? to Cheffish::MergedConfig
  • Loading branch information
tas50 committed Jan 16, 2019
2 parents 450105c + 2707fa1 commit d507e20
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/cheffish/merged_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ def values
keys.map { |key| self[key] }
end

def empty?
configs.empty?
end

def each_pair(&block)
each(&block)
end
Expand Down
9 changes: 9 additions & 0 deletions spec/functional/merged_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
Cheffish::MergedConfig.new(c1, mc)
end

let(:empty_config) do
Cheffish::MergedConfig.new
end

it "returns value in config" do
expect(config.test).to eq("val")
end
Expand Down Expand Up @@ -68,4 +72,9 @@
it "supports nested merged configs" do
expect(nested_config[:test].keys).to eq(%w{test test2})
end

it "supports empty?" do
expect(empty_config.empty?).to eq true
expect(nested_config.empty?).to eq false
end
end

0 comments on commit d507e20

Please sign in to comment.