Sha256: 75cd8503b9ee6ec9c8211480fd9d47f07d4c181033abe4dda419aa5308957f60

Contents?: true

Size: 638 Bytes

Versions: 5

Compression:

Stored size: 638 Bytes

Contents

require File.dirname(__FILE__) + '/../spec_helper'

require "filezor"
describe "Filezor::Util" do
  include Rack::Test::Methods
  
  describe "#md5" do
    it "should md5 a stream" do
      Filezor::Util.md5(StringIO.new("hello")).should == Digest::MD5.hexdigest("hello")
    end
  end
  
  describe "#files_from_map" do
    it "should convert" do
      map = { "foo/bar" => "hello"}
      files = Filezor::Util.files_from_map(map)
      files.size.should == 1
      file = files.first
      file.path.should == "foo/bar"
      file.tempfile.read.should == "hello"
      file.md5.should == Digest::MD5.hexdigest("hello")
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
filezor-1.3.6 spec/filezor/util_spec.rb
filezor-1.3.5 spec/filezor/util_spec.rb
filezor-1.3.4 spec/filezor/util_spec.rb
filezor-1.3.3 spec/filezor/util_spec.rb
filezor-1.3.2 spec/filezor/util_spec.rb