Sha256: 707eeeae7164afc59149d312a151c8b6d7f53872d5f1468f2ce755b13a4292d2
Contents?: true
Size: 1005 Bytes
Versions: 1
Compression:
Stored size: 1005 Bytes
Contents
#encoding: utf-8 require File.join(File.dirname(__FILE__), '..' , 'lib', 'simple_fs', 'file_pool') describe FilePool, "一般操作 " do before(:all) do @pool_path = '/tmp/file_pool' FileUtils.rm_rf @pool_path if Dir.exist? @pool_path Dir.mkdir @pool_path @pool = FilePool::Pool.new @pool_path @fixture_path = File.join(File.dirname(__FILE__), 'fixture', 'test') @fixture_md5 = '4205d2ce2399828dd37f330fd97ec648' end it '初始化' do Dir.exist?(@pool_path).should == true end it '檢查檔案是否存在(新增前)' do @pool.exist?(@fixture_md5).should == false end it '新增檔案' do file_id = @pool.puts(File.open(@fixture_path).read) file_id.should == @fixture_md5 File.exist?(File.join(@pool_path, @fixture_md5)).should == true end it '檢查檔案是否存在(新增後)' do @pool.exist?(@fixture_md5).should == true end it '刪除檔案' do @pool.delete(@fixture_md5) File.exist?(File.join(@pool_path, @fixture_md5)).should == false end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
simple_fs-0.0.1 | spec/filepool_spec.rb |