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-4.2.8.rc2 spec/cf/cli/app/base_spec.rb
cf-4.2.8.rc1 spec/cf/cli/app/base_spec.rb
cf-4.2.7 spec/cf/cli/app/base_spec.rb
cf-4.2.6 spec/cf/cli/app/base_spec.rb
cf-4.2.5 spec/cf/cli/app/base_spec.rb
cf-4.2.4 spec/cf/cli/app/base_spec.rb
cf-4.2.3 spec/cf/cli/app/base_spec.rb
cf-4.2.2.rc3 spec/cf/cli/app/base_spec.rb
cf-4.2.2.rc2 spec/cf/cli/app/base_spec.rb
cf-4.2.2.rc1 spec/cf/cli/app/base_spec.rb
cf-4.2.1 spec/cf/cli/app/base_spec.rb
cf-4.2.1.rc3 spec/cf/cli/app/base_spec.rb
cf-4.2.1.rc2 spec/cf/cli/app/base_spec.rb
cf-4.2.1.rc1 spec/cf/cli/app/base_spec.rb
cf-4.2.0 spec/cf/cli/app/base_spec.rb
cf-4.1.5.rc7 spec/cf/cli/app/base_spec.rb
cf-4.1.5.rc6 spec/cf/cli/app/base_spec.rb
cf-4.1.5.rc5 spec/cf/cli/app/base_spec.rb
cf-4.1.5.rc4 spec/cf/cli/app/base_spec.rb
cf-4.1.5.rc3 spec/cf/cli/app/base_spec.rb