Sha256: 8fdc61908ea9a77e4c59162b82f10902bc6223c938cb316fe1e70e6983826dc8

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'
require 'nokogiri'

module Yarn

  describe DirectoryLister do

    describe "#list" do
      it "returns valid HTML for a directory" do
        response = DirectoryLister.list("lib")
        response.should_not be_nil
        valid_html?(response).should be_true
      end

      it "returns valid HTML a long path" do
        response = DirectoryLister.list("lib/yarn")
        response.should_not be_nil
        valid_html?(response).should be_true
      end
    end

    describe "#format_size" do
      it "should format bytes into B" do
        DirectoryLister.format_size(1.0).should == "1.00B"
      end
      it "should format bytes into KB" do
        DirectoryLister.format_size(1024.0).should == "1.00KB"
      end
      it "should format bytes into MB" do
        DirectoryLister.format_size(1024**2).should == "1.00MB"
      end
      it "should format bytes into GB" do
        DirectoryLister.format_size(1024**3).should == "1.00GB"
      end
      it "should format bytes into TB" do
        DirectoryLister.format_size(1024.0**4).should == "1.00TB"
      end
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
yarn-0.1.0 spec/yarn/directory_lister_spec.rb
yarn-0.0.9 spec/yarn/directory_lister_spec.rb
yarn-0.0.2 spec/yarn/directory_lister_spec.rb