Allow enabling prerelease resolution via environment variable

This commit is contained in:
Chris Roberts 2020-11-06 07:22:01 -08:00
parent 8bb7ca01f9
commit 9506c7b323
2 changed files with 22 additions and 1 deletions

View File

@ -122,7 +122,8 @@ module Vagrant
#
# @return [Boolean]
def self.prerelease?
Gem::Version.new(Vagrant::VERSION).prerelease?
!!ENV["VAGRANT_ALLOW_PRERELEASE"] ||
Gem::Version.new(Vagrant::VERSION).prerelease?
end
# This allows control over dependency resolution when installing

View File

@ -142,6 +142,26 @@ describe Vagrant do
stub_const("Vagrant::VERSION", "1.0.0")
expect(subject.prerelease?).to be(false)
end
context "with environment variable set" do
before { allow(ENV).to receive(:[]).with("VAGRANT_ALLOW_PRERELEASE").and_return("1") }
context "when version is development version" do
before { stub_const("Vagrant::VERSION", "1.0.0.dev") }
it "should return true" do
expect(subject.prerelease?).to be(true)
end
end
context "when version is non-development version" do
before { stub_const("Vagrant::VERSION", "1.0.0") }
it "should return true" do
expect(subject.prerelease?).to be(true)
end
end
end
end
describe ".enable_resolv_replace" do