Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give better error message when fixture project is missing a file #7717

Merged
merged 1 commit into from
Aug 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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