Merge pull request #7874 from chrisroberts/enhancement/cast-box-version

config/vm: cast box version to string before string operations
This commit is contained in:
Chris Roberts 2016-10-10 10:57:53 -07:00 committed by GitHub
commit 7eb1091a71
2 changed files with 9 additions and 1 deletions

View File

@ -581,7 +581,7 @@ module VagrantPlugins
@hostname && @hostname !~ /^[a-z0-9][-.a-z0-9]*$/i
if @box_version
@box_version.split(",").each do |v|
@box_version.to_s.split(",").each do |v|
begin
Gem::Requirement.new(v.strip)
rescue Gem::Requirement::BadRequirementError

View File

@ -133,6 +133,14 @@ describe VagrantPlugins::Kernel_V2::VMConfig do
assert_valid
end
["1", 1, "1.0", 1.0].each do |valid|
it "is valid: #{valid}" do
subject.box_version = valid
subject.finalize!
assert_valid
end
end
end
describe "#communicator" do