Sha256: 5ee1cbc4baa1116a8572b1802d98a422ac09cf51cee303639ed0aebb7edf8955

Contents?: true

Size: 906 Bytes

Versions: 1

Compression:

Stored size: 906 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.1 spec/humanize_bytes_spec.rb