Skip to content

Commit

Permalink
Explicitly raise if attempting to load a missing project fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
brrygrdn committed Mar 25, 2021
1 parent 59f8467 commit a4f321d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bundler/helpers/v1/spec/native_spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@

def project_dependency_files(project)
project_path = File.expand_path(File.join("../../spec/fixtures/projects/bundler1", project))

raise "Fixture does not exist for project: '#{project}'" unless Dir.exist?(project_path)

Dir.chdir(project_path) do
# NOTE: Include dotfiles (e.g. .npmrc)
files = Dir.glob("**/*", File::FNM_DOTMATCH)
Expand Down
4 changes: 4 additions & 0 deletions bundler/helpers/v2/spec/native_spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
LOCKFILE_ENDING = /(?<ending>\s*(?:RUBY VERSION|BUNDLED WITH).*)/m.freeze

def project_dependency_files(project)
# TODO: Retrieve files from bundler2 folder once it is fully up to date
project_path = File.expand_path(File.join("../../spec/fixtures/projects/bundler1", project))

raise "Fixture does not exist for project: '#{project}'" unless Dir.exist?(project_path)

Dir.chdir(project_path) do
# NOTE: Include dotfiles (e.g. .npmrc)
files = Dir.glob("**/*", File::FNM_DOTMATCH)
Expand Down
3 changes: 3 additions & 0 deletions common/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ def build_tmp_repo(project)

def project_dependency_files(project)
project_path = File.expand_path(File.join("spec/fixtures/projects", project))

raise "Fixture does not exist for project: '#{project}'" unless Dir.exist?(project_path)

Dir.chdir(project_path) do
# NOTE: Include dotfiles (e.g. .npmrc)
files = Dir.glob("**/*", File::FNM_DOTMATCH)
Expand Down

0 comments on commit a4f321d

Please sign in to comment.