Sha256: fd78c2510f1fe89e51786ab457ee1053b5de73b0dabc20bfe157139b77c6d87e

Contents?: true

Size: 693 Bytes

Versions: 85

Compression:

Stored size: 693 Bytes

Contents

require "spec_helper"
require "cf/cli/app/base"

describe CF::App::Base do
  describe "#human_size" do
    let(:base) { CF::App::Base.new }

    it { base.human_size(1_023).should == "1023.0B" }
    it { base.human_size(1_024).should == "1.0K" }
    it { base.human_size(1_024 * 1_024).should == "1.0M" }
    it { base.human_size(1_024 * 1_024 * 1.5).should == "1.5M" }
    it { base.human_size(1_024 * 1_024 * 1_024).should == "1.0G" }
    it { base.human_size(1_024 * 1_024 * 1_024 * 1.5).should == "1.5G" }
    it { base.human_size(1_024 * 1_024 * 1_024 * 1.234, 3).should == "1.234G" }
    it { base.human_size(31395840).should == "29.9M" } # tests against floating point errors
  end
end

Version data entries

85 entries across 85 versions & 2 rubygems

Version Path
cf-5.4.7 spec/cf/cli/app/base_spec.rb
cf-5.4.7.rc1 spec/cf/cli/app/base_spec.rb
cf-5.4.5 spec/cf/cli/app/base_spec.rb
cf-5.4.4 spec/cf/cli/app/base_spec.rb
trucker-cli-0.0.3 spec/cf/cli/app/base_spec.rb
cf-5.4.3 spec/cf/cli/app/base_spec.rb
cf-5.4.2 spec/cf/cli/app/base_spec.rb
trucker-cli-0.0.2 spec/cf/cli/app/base_spec.rb
trucker-cli-0.0.1 spec/cf/cli/app/base_spec.rb
cf-5.4.1 spec/cf/cli/app/base_spec.rb
cf-5.4.1.rc1 spec/cf/cli/app/base_spec.rb
cf-5.4.0 spec/cf/cli/app/base_spec.rb
cf-5.3.1 spec/cf/cli/app/base_spec.rb
cf-5.3.0 spec/cf/cli/app/base_spec.rb
cf-5.2.2 spec/cf/cli/app/base_spec.rb
cf-5.2.1.rc15 spec/cf/cli/app/base_spec.rb
cf-5.2.1.rc14 spec/cf/cli/app/base_spec.rb
cf-5.2.1.rc13 spec/cf/cli/app/base_spec.rb
cf-5.2.1.rc12 spec/cf/cli/app/base_spec.rb
cf-5.2.1.rc11 spec/cf/cli/app/base_spec.rb