From dbd8914e0be5e8ec253569e9ca4d55f8555bdfd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Thu, 3 Aug 2023 20:16:17 +0200 Subject: [PATCH] Give better error message when fixture project is missing a file (#7717) --- bundler/spec/spec_helper.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bundler/spec/spec_helper.rb b/bundler/spec/spec_helper.rb index 80f30542c2f5..119bff08d8bd 100644 --- a/bundler/spec/spec_helper.rb +++ b/bundler/spec/spec_helper.rb @@ -29,9 +29,13 @@ def bundler_project_dependency_files(project, directory: "/") end def bundler_project_dependency_file(project, filename:) - dependency_file = bundler_project_dependency_files(project).find { |file| file.name == filename } + project_dependency_files = bundler_project_dependency_files(project) + dependency_file = project_dependency_files.find { |file| file.name == filename } - raise "Dependency File '#{filename} does not exist for project '#{project}'" unless dependency_file + unless dependency_file + raise "Dependency File '#{filename} does not exist for project '#{project}'. " \ + "This is the list of files found:\n * #{project_dependency_files.map(&:name).join("\n * ")}" + end dependency_file end