core: BoxMetadata supports checksums
This commit is contained in:
parent
ce350fe872
commit
23bd397cb8
|
@ -120,9 +120,21 @@ module Vagrant
|
|||
# @return [String]
|
||||
attr_accessor :url
|
||||
|
||||
# The checksum value for this box, if any.
|
||||
#
|
||||
# @return [String]
|
||||
attr_accessor :checksum
|
||||
|
||||
# The type of checksum (if any) associated with this provider.
|
||||
#
|
||||
# @return [String]
|
||||
attr_accessor :checksum_type
|
||||
|
||||
def initialize(raw)
|
||||
@name = raw["name"]
|
||||
@url = raw["url"]
|
||||
@checksum = raw["checksum"]
|
||||
@checksum_type = raw["checksum_type"]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -154,4 +154,19 @@ describe Vagrant::BoxMetadata::Provider do
|
|||
expect(subject.url).to eq("bar")
|
||||
end
|
||||
end
|
||||
|
||||
describe "#checksum and #checksum_type" do
|
||||
it "is set properly" do
|
||||
raw["checksum"] = "foo"
|
||||
raw["checksum_type"] = "bar"
|
||||
|
||||
expect(subject.checksum).to eq("foo")
|
||||
expect(subject.checksum_type).to eq("bar")
|
||||
end
|
||||
|
||||
it "is nil if not set" do
|
||||
expect(subject.checksum).to be_nil
|
||||
expect(subject.checksum_type).to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue