object_pool 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,7 +17,10 @@ class Pool
17
17
  Dir.mkdir(object_dir) unless Dir.exist?(object_dir)
18
18
  File.open(object_path, 'w+') { |f| f.write(row_data) }
19
19
 
20
- return md5
20
+ return {
21
+ :object_id => md5,
22
+ :size => row_data.bytesize
23
+ }
21
24
  end
22
25
 
23
26
  def delete(object_id)
@@ -1,3 +1,3 @@
1
1
  module ObjectPool
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -11,6 +11,7 @@ describe ObjectPool do
11
11
  @pool = ObjectPool::Pool.new @pool_path
12
12
  @fixture_data = "This is a test file."
13
13
  @fixture_md5 = Digest::MD5.hexdigest(@fixture_data)
14
+ @fixture_size = @fixture_data.bytesize
14
15
  end
15
16
 
16
17
  describe '#initialize' do
@@ -24,8 +25,11 @@ describe ObjectPool do
24
25
  @object_id = @pool.put(@fixture_data)
25
26
  end
26
27
 
27
- it '回傳值應該是資料的MD5' do
28
- @object_id.should == @fixture_md5
28
+ it '回傳值應該是正確的' do
29
+ @object_id.should == {
30
+ :object_id => @fixture_md5,
31
+ :size => @fixture_size
32
+ }
29
33
  end
30
34
 
31
35
  it '新增後檔案應該存在' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: object_pool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: