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