summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pitman <michaelp@ibglobalweb.com>2017-08-28 21:17:36 +1000
committerMichael Pitman <michaelp@ibglobalweb.com>2017-08-28 21:17:36 +1000
commit5b6b04439a6fe218c55680a12e74c2a3a76972c8 (patch)
treedb57c77e152a05c875191001dae43d7664e8f689
parentec196cd54653879932f2e0fc3a2e0aec643405b2 (diff)
downloadbundler-5b6b04439a6fe218c55680a12e74c2a3a76972c8.tar.gz
Add more specs to cover the particular issue discovered when running under jruby
-rw-r--r--spec/bundler/shared_helpers_spec.rb31
1 files changed, 30 insertions, 1 deletions
diff --git a/spec/bundler/shared_helpers_spec.rb b/spec/bundler/shared_helpers_spec.rb
index 3c9dd263bc..976f2f6335 100644
--- a/spec/bundler/shared_helpers_spec.rb
+++ b/spec/bundler/shared_helpers_spec.rb
@@ -261,7 +261,7 @@ RSpec.describe Bundler::SharedHelpers do
subject.set_bundle_environment
end
- it "exits if bundle path contains the path separator" do
+ it "exits if bundle path contains the unix-like path separator" do
allow(Gem).to receive(:path_separator).and_return(":")
allow(Bundler).to receive(:bundle_path) { Pathname.new("so:me/dir/bin") }
expect { subject.send(:validate_bundle_path) }.to raise_error(
@@ -275,6 +275,35 @@ RSpec.describe Bundler::SharedHelpers do
)
end
+ it "does not exit if bundle path is the jruby/warbler standard uri path" do
+ allow(Gem).to receive(:path_separator).and_return(
+ /(?<!jar:file|jar|file|classpath|uri:classloader|uri|http|https):/
+ )
+ allow(Bundler).to receive(:bundle_path) { Pathname.new("uri:classloader:/WEB-INF/gems") }
+ expect { subject.send(:validate_bundle_path) }.not_to raise_error(Bundler::PathError)
+ end
+
+ it "exits if bundle path contains another directory with the jruby uri path separator" do
+ allow(Gem).to receive(:path_separator).and_return(
+ /(?<!jar:file|jar|file|classpath|uri:classloader|uri|http|https):/
+ )
+ allow(Bundler).to receive(:bundle_path) {
+ Pathname.new("uri:classloader:/WEB-INF/gems:other/dir")
+ }
+
+ expect { subject.send(:validate_bundle_path) }.to raise_error(
+ Bundler::PathError,
+ "Your bundle path contains text matching " \
+ "/(?<!jar:file|jar|file|classpath|uri:classloader|uri|http|https):/, which is the " \
+ "path separator for your system. Bundler cannot " \
+ "function correctly when the Bundle path contains the " \
+ "system's PATH separator. Please change your " \
+ "bundle path to not match " \
+ "/(?<!jar:file|jar|file|classpath|uri:classloader|uri|http|https):/." \
+ "\nYour current bundle path is '#{Bundler.bundle_path}'."
+ )
+ end
+
context "ENV['PATH'] does not exist" do
before { ENV.delete("PATH") }