From e97dc07ba3164a936c527994eff9e864d7c52a98 Mon Sep 17 00:00:00 2001 From: Liang Tao Date: Wed, 19 Mar 2014 14:11:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=B5=8B=E8=AF=95=E7=94=A8?= =?UTF-8?q?=E4=BE=8B=EF=BC=8C=E5=BB=BA=E7=AB=8B=E5=9B=BA=E5=AE=9ABucket?= =?UTF-8?q?=EF=BC=88=E7=94=A8=E5=90=8E=E4=B8=8D=E5=88=A0=E9=99=A4=EF=BC=89?= =?UTF-8?q?=EF=BC=8C=E9=81=BF=E5=85=8D631=E5=93=8D=E5=BA=94=E7=A0=81?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spec/qiniu/image_spec.rb | 12 ++++++------ spec/qiniu/management_spec.rb | 10 +++++----- spec/qiniu/misc_spec.rb | 4 ++++ spec/qiniu/upload_spec.rb | 9 +++++---- 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/spec/qiniu/image_spec.rb b/spec/qiniu/image_spec.rb index 986c9c0..1047ef2 100755 --- a/spec/qiniu/image_spec.rb +++ b/spec/qiniu/image_spec.rb @@ -11,12 +11,14 @@ module Qiniu before :all do - @bucket = 'RubySdkTest' + (Time.now.to_i+rand(1000)).to_s - @key = "image_logo_for_test.png" + ### 复用RubySDK-Test-Storage空间 + @bucket = 'RubySDK-Test-Storage' + ### 尝试创建空间 result = Qiniu.mkbucket(@bucket) puts result.inspect - result.should be_true + + @key = "image_logo_for_test.png" local_file = File.expand_path('../' + @key, __FILE__) @@ -53,9 +55,7 @@ module Qiniu end after :all do - result = Qiniu.drop(@bucket) - puts result.inspect - result.should_not be_false + ### 不删除Bucket以备下次使用 end context ".info" do diff --git a/spec/qiniu/management_spec.rb b/spec/qiniu/management_spec.rb index f624b3a..b780534 100755 --- a/spec/qiniu/management_spec.rb +++ b/spec/qiniu/management_spec.rb @@ -12,13 +12,13 @@ module Qiniu before :all do @bucket = 'RubySDK-Test-Management' - @key = Digest::SHA1.hexdigest((Time.now.to_i+rand(100)).to_s) - @key2 = @key + rand(100).to_s ### 尝试创建Bucket - code, data = Storage.mkbucket(@bucket) - puts [code, data].inspect - code.should == 200 + result = Qiniu.mkbucket(@bucket) + puts result.inspect + + @key = Digest::SHA1.hexdigest((Time.now.to_i+rand(100)).to_s) + @key2 = @key + rand(100).to_s end after :all do diff --git a/spec/qiniu/misc_spec.rb b/spec/qiniu/misc_spec.rb index b4f0d35..e970ce9 100755 --- a/spec/qiniu/misc_spec.rb +++ b/spec/qiniu/misc_spec.rb @@ -12,9 +12,13 @@ module Qiniu before :all do ### 复用RubySDK-Test-Management空间 @bucket = 'RubySDK-Test-Management' + + result = Qiniu.mkbucket(@bucket) + puts result.inspect end after :all do + ### 不删除Bucket以备下次使用 end context ".set_protected" do diff --git a/spec/qiniu/upload_spec.rb b/spec/qiniu/upload_spec.rb index 4ed58a2..bdb1631 100755 --- a/spec/qiniu/upload_spec.rb +++ b/spec/qiniu/upload_spec.rb @@ -11,6 +11,11 @@ module Qiniu before :all do @bucket = 'RubySDK-Test-Storage' + + ### 尝试创建Bucket + result = Qiniu.mkbucket(@bucket) + puts result.inspect + @key = Digest::SHA1.hexdigest((Time.now.to_i+rand(100)).to_s) @localfile_5m = "5M.txt" @@ -28,10 +33,6 @@ module Qiniu @localfile_1m = "1M.txt" File.open(@localfile_1m, "w"){|f| (1 << 20).times{ f.write(rand(9).to_s) }} @key_1m = Digest::SHA1.hexdigest(@localfile_1m+Time.now.to_s) - - ### 尝试创建Bucket - result = Qiniu.mkbucket(@bucket) - puts result.inspect end after :all do