Add shared helper method to detect if running version is prerelease
This commit is contained in:
parent
363476fbae
commit
abf38106c0
|
@ -102,4 +102,12 @@ module Vagrant
|
|||
|
||||
Pathname.new(path).expand_path
|
||||
end
|
||||
|
||||
# This returns true/false if the running version of Vagrant is
|
||||
# a pre-release version (development)
|
||||
#
|
||||
# @return [Boolean]
|
||||
def self.prerelease?
|
||||
Gem::Version.new(Vagrant::VERSION).prerelease?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -131,4 +131,16 @@ describe Vagrant do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#prerelease?" do
|
||||
it "should return true when Vagrant version is development" do
|
||||
stub_const("Vagrant::VERSION", "1.0.0.dev")
|
||||
expect(subject.prerelease?).to be(true)
|
||||
end
|
||||
|
||||
it "should return false when Vagrant version is release" do
|
||||
stub_const("Vagrant::VERSION", "1.0.0")
|
||||
expect(subject.prerelease?).to be(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue