Include unit test for numeric class
This commit is contained in:
parent
2e324a4971
commit
cd98a8bf64
|
@ -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
|
Loading…
Reference in New Issue