Skip to content

Commit

Permalink
Give better error message when fixture project is missing a file (#7717)
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez authored Aug 3, 2023
1 parent 4c640f2 commit 7a8a899
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bundler/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7a8a899

Please sign in to comment.