Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
fix rubocop failures
Browse files Browse the repository at this point in the history
  • Loading branch information
ajwann committed Aug 7, 2017
1 parent 944862e commit 5f0b690
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
10 changes: 5 additions & 5 deletions lib/bundler/shared_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,11 @@ def md5_available?
private

def validate_bundle_path
if Bundler.bundle_path.to_s.match(File::PATH_SEPARATOR)
puts 'WARNING: Your bundle path contains a ":", which can cause problems.'
puts 'Please change your bundle path path to not include ":".'
exit(1)
end
return unless Bundler.bundle_path.to_s.match(File::PATH_SEPARATOR)
puts "WARNING: Your bundle path contains a '#{File::PATH_SEPARATOR}', " \
"which is the path separator for your system."
puts "Please change your bundle path path to not include '#{File::PATH_SEPARATOR}'."
exit(1)
end

def find_gemfile(order_matters = false)
Expand Down
22 changes: 18 additions & 4 deletions spec/bundler/shared_helpers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,27 @@
end

it "exits if bundle path contains the path seperator" do
File::PATH_SEPARATOR = ':'
stub_const("File::PATH_SEPARATOR", ":".freeze)
allow(Bundler).to receive(:bundle_path) { "so:me/dir/bin" }
expect(subject.send(:validate_bundle_path)).to raise_error(SystemExit)
begin
expect(subject.send(:validate_bundle_path)).to raise_exception(SystemExit).
and output("WARNING: Your bundle path contains a ':', which is the" \
" path separator for your system. Please change your" \
" bundle path path to not include ':'.")
rescue SystemExit => e
expect(e.status).to eq(1)
end

File::PATH_SEPARATOR = '^'
stub_const("File::PATH_SEPARATOR", "^".freeze)
allow(Bundler).to receive(:bundle_path) { "so^me/dir/bin" }
expect(subject.send(:validate_bundle_path)).to raise_error(SystemExit)
begin
expect(subject.send(:validate_bundle_path)).to raise_exception(SystemExit).
and output("WARNING: Your bundle path contains a '^', which is the" \
" path separator for your system. Please change your" \
" bundle path path to not include '^'.")
rescue SystemExit => e
expect(e.status).to eq(1)
end
end

context "ENV['PATH'] does not exist" do
Expand Down

0 comments on commit 5f0b690

Please sign in to comment.