summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBundlerbot <bot@bundler.io>2019-04-02 08:46:08 +0000
committerBundlerbot <bot@bundler.io>2019-04-02 08:46:08 +0000
commit4cae424d604cbeb8ee84127a6b8896c45e7e2c84 (patch)
treed12dd29d9e560db49774959c5bdfd60e43f78169
parentd6f343cc5b69185c0bb45140d9e6b1fc4121688b (diff)
parent5f7f860dc5ba5cfeecc8c35e4616cd55e205b431 (diff)
downloadbundler-4cae424d604cbeb8ee84127a6b8896c45e7e2c84.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>
-rw-r--r--spec/lock/lockfile_spec.rb2
-rw-r--r--spec/support/helpers.rb12
-rw-r--r--spec/support/matchers.rb4
3 files changed, 11 insertions, 7 deletions
diff --git a/spec/lock/lockfile_spec.rb b/spec/lock/lockfile_spec.rb
index f98ff11dd7..7f6ec77651 100644
--- a/spec/lock/lockfile_spec.rb
+++ b/spec/lock/lockfile_spec.rb
@@ -76,7 +76,7 @@ RSpec.describe "the lockfile format", :bundler => "2" 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 b3d061c917..7a78cee670 100644
--- a/spec/support/helpers.rb
+++ b/spec/support/helpers.rb
@@ -264,18 +264,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 0a9285837a..f9efe32a38 100644
--- a/spec/support/matchers.rb
+++ b/spec/support/matchers.rb
@@ -194,7 +194,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)
@@ -212,7 +212,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)