Sha256: e28b3fcd24b5d63bb28b164d0db968a95c9df92a31604d6a47eb1eed94c07f5b

Contents?: true

Size: 898 Bytes

Versions: 1

Compression:

Stored size: 898 Bytes

Contents

require 'spec_helper'

describe Humanize::Bytes do
  describe "#initialize" do
    context "when no unit is specified" do
      it "should return a new Byte instance" do
        Humanize::Bytes.initialize(1024).should be_instance_of(Humanize::Bytes::Byte)
      end
    end

    context "when kilo is specfied as unit" do
      it "should return a new Kilo instance" do
        Humanize::Bytes.initialize(1024, 'k').should be_instance_of(Humanize::Bytes::Kilo)
      end
    end

    context "when mega is specfied as unit" do
      it "should return a new Mega instance" do
        Humanize::Bytes.initialize(1024, 'm').should be_instance_of(Humanize::Bytes::Mega)
      end
    end

    context "when giga is specfied as unit" do
      it "should return a new Giga instance" do
        Humanize::Bytes.initialize(1024, 'g').should be_instance_of(Humanize::Bytes::Giga)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
humanize-bytes-0.0.2 spec/humanize_bytes_spec.rb