diff options
author | Michael Pitman <michaelp@ibglobalweb.com> | 2017-08-29 16:52:00 +1000 |
---|---|---|
committer | Michael Pitman <michaelp@ibglobalweb.com> | 2017-08-29 16:52:00 +1000 |
commit | fa09f53fc75eb9cece77d91801d426338810af59 (patch) | |
tree | aed18a1e865b22c02aa0592e00f0cdb0df970d28 | |
parent | ab8c6381af8ad62c7af8edf3a6996c3f24f1793d (diff) | |
download | bundler-fa09f53fc75eb9cece77d91801d426338810af59.tar.gz |
Exclude the specs that require ruby 1.9 regexes from spec runs under ruby 1.8
-rw-r--r-- | spec/bundler/shared_helpers_spec.rb | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/spec/bundler/shared_helpers_spec.rb b/spec/bundler/shared_helpers_spec.rb index d5f1a826c5..7a952708ed 100644 --- a/spec/bundler/shared_helpers_spec.rb +++ b/spec/bundler/shared_helpers_spec.rb @@ -279,35 +279,37 @@ RSpec.describe Bundler::SharedHelpers do ) end - it "does not exit if bundle path is the jruby/warbler standard uri path", :ruby => "> 1.8.7" 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", :ruby => "> 1.8.7" 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") - } + 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 - 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}'." - ) + 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 end + context "ENV['PATH'] does not exist" do before { ENV.delete("PATH") } |