Skip to content

Commit

Permalink
Fix OpenConfigurator to handle blank yaml files
Browse files Browse the repository at this point in the history
  • Loading branch information
apexatoll committed Nov 9, 2023
1 parent e25d3b7 commit 7653422
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/kangaru/configurators/open_configurator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def initialize(**)
def self.from_yaml_file(path)
raise "path does not exist" unless File.exist?(path)

attributes = YAML.load_file(path).symbolise
attributes = YAML.load_file(path)&.symbolise || {}

new(**attributes)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/features/external_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ module SomeGem
context "and config exists at the specified path" do
before { config_path.write(config_file) }

context "and config file is empty", skip: :bug_fix do
context "and config file is empty" do
let(:config_file) { "" }

include_examples :does_not_set_external_config
Expand Down
2 changes: 1 addition & 1 deletion spec/kangaru/configurators/open_configurator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
context "when specified file exists" do
let(:exists?) { true }

context "and file is empty", skip: :bug_fix do
context "and file is empty" do
let(:string_hash) { nil }

it "does not raise any errors" do
Expand Down

0 comments on commit 7653422

Please sign in to comment.