diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-04-01 17:23:42 +0200 |
---|---|---|
committer | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-04-01 17:23:42 +0200 |
commit | 5f7f860dc5ba5cfeecc8c35e4616cd55e205b431 (patch) | |
tree | c60a2684e77d24c87c774ae6d3abb7a9e750571b | |
parent | bd5e0cf17c8119397cbd1cf9745c62c3352e9caf (diff) | |
download | bundler-normalize_uris_in_lockfiles.tar.gz |
Fix spec about lockfile writingnormalize_uris_in_lockfiles
This change is simple but not easy to explain. What this test does is to
ensure that if bundle install doesn't change anything, then the bundler
version in the lockfile does not get rewritten.
Whereas this test was passing, the implementation was wrong, but two
bugs were "compesating for each other" and making it pass. The
explanation is the following:
Due to a regression in rubygems, in rubygems 3+ "2.0.0.0.a" is
considered higher than "2.0.0.dev". This changes the test because
bundler will never dowgrade the bundler version in a lockfile, so even
if the lockfile gets rewritten, it will still keep "2.0.0.0.a", since
it's considered higher.
However, if we change the test to use "2.0.0.a" instead of "2.0.0.dev",
then the test starts failing and shows the bug in the test.
The bug is that the lock file in the test is written with
"file://localhost" style URLs. However, the lockfile that would be
generated would contain "file://" style URLs. This would trick bundler
into thinking that something has been changed by `bundle install`, so it
will rewrite the lock file, use "2.0.0.dev" as the locked bundler
version, and cause the test to fail.
-rw-r--r-- | spec/lock/lockfile_spec.rb | 2 | ||||
-rw-r--r-- | spec/support/helpers.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/spec/lock/lockfile_spec.rb b/spec/lock/lockfile_spec.rb index 0809258859..e9c366009a 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 72a94ea326..896d60435e 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -283,7 +283,7 @@ module Spec if contents.nil? File.open("Gemfile.lock", "r", &:read) else - create_file("Gemfile.lock", contents, *args) + create_file("Gemfile.lock", normalize_uri_file(contents), *args) end end |