Sha256: b16e6a0a0bbba1e442ef1e724f54bf9adb7be00591c15de3e4f65cb0eadc6ff5
Contents?: true
Size: 955 Bytes
Versions: 2
Compression:
Stored size: 955 Bytes
Contents
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Lolita::Support::Bytes do let(:klass){Lolita::Support::Bytes} it "should recognize bytes" do conv=klass.new(512) conv.unit.should == "bytes" conv.value.should == 512.0 end it "should recognize kilobytes" do conv=klass.new(1024+6) conv.unit.should == "kilobytes" conv.value.should == 1.01 end it "should recognize megabytes" do conv=klass.new(1024**2) conv.unit.should == "megabyte" conv.value.should == 1.0 end it "should recognize gigabytes" do conv=klass.new(1024**3+1024**2*10) conv.unit.should == "gigabytes" conv.value.should == 1.01 end it "should take next unit when rounding move to next limit" do conv=klass.new(1024**2-1) conv.value.should == 1.0 conv.unit.should == "megabyte" end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lolita-file-upload-0.2.1 | spec/lolita/support/bytes_spec.rb |
lolita-file-upload-0.2.0 | spec/lolita/support/bytes_spec.rb |