Skip to content

Commit

Permalink
Guard against empty YAML fixture files breaking processing
Browse files Browse the repository at this point in the history
  • Loading branch information
kaspth committed Nov 3, 2023
1 parent a5f8e5f commit dfcc18e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/generators/oaken/convert/fixtures_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def prepare
def parse
@fixtures = Dir.glob("test/fixtures/**/*.yml").to_h do |path|
model_name = path.delete_prefix("test/fixtures/").chomp(".yml")
[model_name, YAML.load_file(path)&.map { Oaken::Convert::Fixture.new(model_name, _1, _2) }]
[model_name, YAML.load_file(path).presence&.map { Oaken::Convert::Fixture.new(model_name, _1, _2) }]
rescue Psych::SyntaxError
say "Skipped #{path} due to ERB content or other YAML parsing issues.", :yellow
end.tap(&:compact_blank!)
Expand Down

0 comments on commit dfcc18e

Please sign in to comment.