diff options
author | Bundlerbot <bot@bundler.io> | 2019-04-02 08:46:08 +0000 |
---|---|---|
committer | Colby Swandale <me@colby.fyi> | 2019-04-08 16:39:04 +1000 |
commit | 1fd59fa141ae04f8804618c86473daec880fa3e7 (patch) | |
tree | a8b05370ccd51ff0be826fac66446a59637d6542 | |
parent | 531fcaa62cc68a3263de06c4dbbd6a56ecacfa28 (diff) | |
download | bundler-1fd59fa141ae04f8804618c86473daec880fa3e7.tar.gz |
Merge #7089
7089: Normalize file URIs in spec's lockfiles r=hsbt a=deivid-rodriguez
### What was the end-user problem that led to this PR?
The problem was that bumping bundler's version in #7088 made a lockfile spec fail.
### What was your diagnosis of the problem?
My diagnosis was that there was a combination of bugs that was making this spec pass, but the spec was incorrect.
### What is your fix for the problem, implemented in this PR?
My fix is to change the test version the spec uses to not hit https://github.com/rubygems/rubygems/issues/2595, and thus reproduce the failure. And then fix the spec that was incorrect because the lockfile written had different URLs (`file://localhost/<stuff>`) from the lockfile we were checking against (`file://<stuff>`), thus tricking `bundle install` into thinking something had changed, and thus making it rewrite it with an incorrect bundler version.
### Why did you choose this fix out of the possible options?
I chose this fix because it makes #7088 pass and it reduces surprises.
Co-authored-by: David RodrÃguez <deivid.rodriguez@riseup.net>
(cherry picked from commit 4cae424d604cbeb8ee84127a6b8896c45e7e2c84)
-rw-r--r-- | spec/lock/lockfile_spec.rb | 2 | ||||
-rw-r--r-- | spec/support/helpers.rb | 12 | ||||
-rw-r--r-- | spec/support/matchers.rb | 4 |
3 files changed, 11 insertions, 7 deletions
diff --git a/spec/lock/lockfile_spec.rb b/spec/lock/lockfile_spec.rb index 9e2fb3b2dd..ea454fe912 100644 --- a/spec/lock/lockfile_spec.rb +++ b/spec/lock/lockfile_spec.rb @@ -76,7 +76,7 @@ RSpec.describe "the lockfile format", :bundler => "3" do end it "does not update the lockfile's bundler version if nothing changed during bundle install" do - version = "#{Bundler::VERSION.split(".").first}.0.0.0.a" + version = "#{Bundler::VERSION.split(".").first}.0.0.a" lockfile <<-L GEM diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index ff1f5c39b3..0c018c6c68 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -263,18 +263,22 @@ module Spec end def gemfile(*args) - if args.empty? + contents = args.shift + + if contents.nil? File.open("Gemfile", "r", &:read) else - create_file("Gemfile", *args) + create_file("Gemfile", contents, *args) end end def lockfile(*args) - if args.empty? + contents = args.shift + + if contents.nil? File.open("Gemfile.lock", "r", &:read) else - create_file("Gemfile.lock", *args) + create_file("Gemfile.lock", normalize_uri_file(contents), *args) end end diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb index 8e17be3a02..76aeffb288 100644 --- a/spec/support/matchers.rb +++ b/spec/support/matchers.rb @@ -218,7 +218,7 @@ module Spec RSpec::Matchers.alias_matcher :include_gem, :include_gems def have_lockfile(expected) - read_as(strip_whitespace(expected)) + read_as(normalize_uri_file(strip_whitespace(expected))) end def plugin_should_be_installed(*names) @@ -236,7 +236,7 @@ module Spec end def lockfile_should_be(expected) - expect(bundled_app("Gemfile.lock")).to read_as(normalize_uri_file(strip_whitespace(expected))) + expect(bundled_app("Gemfile.lock")).to have_lockfile(expected) end def gemfile_should_be(expected) |