diff options
author | Michael Pitman <michaelp@ibglobalweb.com> | 2017-08-30 07:43:52 +1000 |
---|---|---|
committer | Michael Pitman <michaelp@ibglobalweb.com> | 2017-08-30 07:43:52 +1000 |
commit | d08d8de87d459bfa1d3e3e522a4284a503855be8 (patch) | |
tree | 652a5dea0a2a07021c4c138b2122e03d688fb7c9 | |
parent | 00f6db4ad2499e7820a82f4c3b8d7b166bdfbe4e (diff) | |
download | bundler-d08d8de87d459bfa1d3e3e522a4284a503855be8.tar.gz |
Use a ruby declaration, rather than relying on RUBY_VERSION to run the specs that rely on a ruby >= 1.9 style regex
-rw-r--r-- | spec/bundler/shared_helpers_spec.rb | 52 |
1 files changed, 25 insertions, 27 deletions
diff --git a/spec/bundler/shared_helpers_spec.rb b/spec/bundler/shared_helpers_spec.rb index 83f0a25178..a93d81f4b5 100644 --- a/spec/bundler/shared_helpers_spec.rb +++ b/spec/bundler/shared_helpers_spec.rb @@ -279,33 +279,31 @@ RSpec.describe Bundler::SharedHelpers do ) end - if RUBY_VERSION.to_f > 1.8 # In versions of jruby that supported ruby 1.8, the path separator was the standard File::PATH_SEPARATOR - context "with a jruby path_separator regex" do - let(:regex) { /(?<!jar:file|jar|file|classpath|uri:classloader|uri|http|https):/ } - it "does not exit if bundle path is the standard uri path" do - allow(Gem).to receive(:path_separator).and_return(regex) - allow(Bundler).to receive(:bundle_path) { Pathname.new("uri:classloader:/WEB-INF/gems") } - expect { subject.send(:validate_bundle_path) }.not_to raise_error - end - - it "exits if bundle path contains another directory" do - allow(Gem).to receive(:path_separator).and_return(regex) - 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 "with a jruby path_separator regex", :ruby => "1.9" do # In versions of jruby that supported ruby 1.8, the path separator was the standard File::PATH_SEPARATOR + let(:regex) { /(?<!jar:file|jar|file|classpath|uri:classloader|uri|http|https):/ } + it "does not exit if bundle path is the standard uri path" do + allow(Gem).to receive(:path_separator).and_return(regex) + allow(Bundler).to receive(:bundle_path) { Pathname.new("uri:classloader:/WEB-INF/gems") } + expect { subject.send(:validate_bundle_path) }.not_to raise_error + end + + it "exits if bundle path contains another directory" do + allow(Gem).to receive(:path_separator).and_return(regex) + 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 end |