summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Wanninger <ajwann@users.noreply.github.com>2017-08-06 12:49:23 -0400
committerAdam Wanninger <ajwann@users.noreply.github.com>2017-08-07 18:19:08 -0400
commit5f0b690ef07b4ed33f092c79e2b0944c95b738bc (patch)
tree4042428c6e02d9feafa5ba0a5ced2ce96b35fcf4
parent944862e7e75b07e2400baedf6d637a7467284add (diff)
downloadbundler-5f0b690ef07b4ed33f092c79e2b0944c95b738bc.tar.gz
fix rubocop failures
-rw-r--r--lib/bundler/shared_helpers.rb10
-rw-r--r--spec/bundler/shared_helpers_spec.rb22
2 files changed, 23 insertions, 9 deletions
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb
index 909125171e..a189b8dc21 100644
--- a/lib/bundler/shared_helpers.rb
+++ b/lib/bundler/shared_helpers.rb
@@ -204,11 +204,11 @@ module Bundler
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)
diff --git a/spec/bundler/shared_helpers_spec.rb b/spec/bundler/shared_helpers_spec.rb
index 9ec6ff1796..59e304c5e7 100644
--- a/spec/bundler/shared_helpers_spec.rb
+++ b/spec/bundler/shared_helpers_spec.rb
@@ -262,13 +262,27 @@ RSpec.describe Bundler::SharedHelpers do
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