diff options
Diffstat (limited to 'spec/bundler/lock/lockfile_spec.rb')
-rw-r--r-- | spec/bundler/lock/lockfile_spec.rb | 108 |
1 files changed, 102 insertions, 6 deletions
diff --git a/spec/bundler/lock/lockfile_spec.rb b/spec/bundler/lock/lockfile_spec.rb index 4e9e0f5fc3..9170efeedd 100644 --- a/spec/bundler/lock/lockfile_spec.rb +++ b/spec/bundler/lock/lockfile_spec.rb @@ -166,9 +166,10 @@ RSpec.describe "the lockfile format" do G end - it "warns if the current is older than lockfile's bundler version" do - current_version = Bundler::VERSION - newer_minor = bump_minor(current_version) + it "warns if the current version is older than lockfile's bundler version, and locked version is a final release" do + current_version = "999.998.999" + system_gems "bundler-#{current_version}" + newer_minor = "999.999.0" lockfile <<-L GEM @@ -186,17 +187,66 @@ RSpec.describe "the lockfile format" do #{newer_minor} L - install_gemfile <<-G + install_gemfile <<-G, :env => { "BUNDLER_VERSION" => current_version } + source "#{file_uri_for(gem_repo2)}" + + gem "rack" + G + + warning_message = "the running version of Bundler (#{current_version}) is older " \ + "than the version that created the lockfile (#{newer_minor}). " \ + "We suggest you to upgrade to the version that created the " \ + "lockfile by running `gem install bundler:#{newer_minor}`." + expect(err).to include warning_message + + lockfile_should_be <<-G + GEM + remote: #{file_uri_for(gem_repo2)}/ + specs: + rack (1.0.0) + + PLATFORMS + #{lockfile_platforms} + + DEPENDENCIES + rack + + BUNDLED WITH + #{newer_minor} + G + end + + it "warns if the current version is older than lockfile's bundler version, and locked version is a prerelease" do + current_version = "999.998.999" + system_gems "bundler-#{current_version}" + newer_minor = "999.999.0.pre1" + + lockfile <<-L + GEM + remote: #{file_uri_for(gem_repo2)}/ + specs: + rack (1.0.0) + + PLATFORMS + #{lockfile_platforms} + + DEPENDENCIES + rack + + BUNDLED WITH + #{newer_minor} + L + + install_gemfile <<-G, :env => { "BUNDLER_VERSION" => current_version } source "#{file_uri_for(gem_repo2)}" gem "rack" G - pre_flag = prerelease?(newer_minor) ? " --pre" : "" warning_message = "the running version of Bundler (#{current_version}) is older " \ "than the version that created the lockfile (#{newer_minor}). " \ "We suggest you to upgrade to the version that created the " \ - "lockfile by running `gem install bundler:#{newer_minor}#{pre_flag}`." + "lockfile by running `gem install bundler:#{newer_minor} --pre`." expect(err).to include warning_message lockfile_should_be <<-G @@ -216,6 +266,52 @@ RSpec.describe "the lockfile format" do G end + it "doesn't warn if the current version is older than lockfile's bundler version, and locked version is a dev version" do + current_version = "999.998.999" + system_gems "bundler-#{current_version}" + newer_minor = "999.999.0.dev" + + lockfile <<-L + GEM + remote: #{file_uri_for(gem_repo2)}/ + specs: + rack (1.0.0) + + PLATFORMS + #{lockfile_platforms} + + DEPENDENCIES + rack + + BUNDLED WITH + #{newer_minor} + L + + install_gemfile <<-G, :env => { "BUNDLER_VERSION" => current_version } + source "#{file_uri_for(gem_repo2)}" + + gem "rack" + G + + expect(err).to be_empty + + lockfile_should_be <<-G + GEM + remote: #{file_uri_for(gem_repo2)}/ + specs: + rack (1.0.0) + + PLATFORMS + #{lockfile_platforms} + + DEPENDENCIES + rack + + BUNDLED WITH + #{newer_minor} + G + end + it "warns when updating bundler major version" do current_version = Bundler::VERSION older_major = previous_major(current_version) |