Include unit test for numeric class

This commit is contained in:
Brian Cain 2019-11-15 15:26:17 -08:00
parent 2e324a4971
commit cd98a8bf64
No known key found for this signature in database
GPG Key ID: 9FC4639B2E4510A0
1 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,21 @@
require File.expand_path("../../../base", __FILE__)
require "vagrant/util/numeric"
describe Vagrant::Util::Numeric do
include_context "unit"
before(:each) { described_class.reset! }
subject { described_class }
describe "#string_to_bytes" do
it "converts a string to the proper bytes" do
bytes = subject.string_to_bytes("10KB")
expect(bytes).to eq(10240)
end
it "returns nil if the given string is the wrong format" do
bytes = subject.string_to_bytes("10 Kilobytes")
expect(bytes).to eq(nil)
end
end
end