Sha256: d50f9e95e8a0739269b089e773d3c01d5b1aa90616b731a94d30fc56a450f74b
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
require 'spec_helper' describe Humanize::Bytes::Byte do let(:b) { Humanize::Bytes::Byte.new(2147843648) } context "#value" do it "should return the value" do b.value.should == 2147843648 end end context "#to_b" do it "should return the value" do b.to_b.should == 2147843648 end end context "#to_k" do it "should convert the value to kilo bytes" do b.to_k.should == 2097503.5625 end end context "#to_m" do it "should convert the value to mega bytes" do b.to_m.should == 2048.3433227539062 end end context "#to_g" do it "should convert the value to giga bytes" do b.to_g.should == 2.0003352761268616 end end context "#to_s" do context "when value is an integer" do it "should print a humanized version of the value" do b.to_s.should == '2147843648 bytes' end end context "when value is an integer" do it "should print a humanized version of the value" do Humanize::Bytes::Byte.new(4.997).to_s.should == '4.99 bytes' end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
humanize-bytes-0.1.0 | spec/humanize_bytes/byte_spec.rb |
humanize-bytes-0.0.2 | spec/humanize_bytes/byte_spec.rb |