add Qiniu::RS::UP module

This commit is contained in:
404
2012-10-02 18:47:19 +08:00
parent fa40449b12
commit bd34ea428e
14 changed files with 416 additions and 22 deletions
+30
View File
@@ -0,0 +1,30 @@
# -*- encoding: utf-8 -*-
require 'spec_helper'
require 'qiniu/rs/abstract'
describe Qiniu::RS::Abstract do
before(:each) do
@klass = Class.new do
include Qiniu::RS::Abstract
abstract_methods :foo, :bar
end
end
it "raises NotImplementedError" do
proc {
@klass.new.foo
}.should raise_error(NotImplementedError)
end
it "can be overridden" do
subclass = Class.new(@klass) do
def foo
:overridden
end
end
subclass.new.foo.should == :overridden
end
end
+3 -3
View File
@@ -17,22 +17,22 @@ module Qiniu
@domain = 'iovip.qbox.me/test'
code, data = Qiniu::RS::RS.mkbucket(@bucket)
code.should == 200
puts data.inspect
code.should == 200
end
context "IO.upload_file" do
it "should works" do
code, data = Qiniu::RS::IO.put_auth()
puts data.inspect
code.should == 200
data["url"].should_not be_empty
data["expiresIn"].should_not be_zero
puts data.inspect
@put_url = data["url"]
code2, data2 = Qiniu::RS::IO.upload_file(@put_url, __FILE__, @bucket, @key)
code2.should == 200
puts data2.inspect
code2.should == 200
end
end
+2 -2
View File
@@ -3,8 +3,8 @@
require 'spec_helper'
require 'qiniu/rs/version'
describe Qiniu::RS do
describe Qiniu::RS::Version do
it "should has a VERSION" do
Qiniu::RS::VERSION.should =~ /^\d+\.\d+\.\d+?$/
Qiniu::RS::Version.to_s.should =~ /^\d+\.\d+\.\d+?$/
end
end
+5
View File
@@ -6,6 +6,7 @@ require 'rspec'
RSpec.configure do |config|
config.before :all do
=begin
Qiniu::RS.establish_connection! :access_key => "dFX_wMGVrRzwdWaraW-Qe5ZCDT-kcSmIAGKQOkXh",
:secret_key => "VllxxDfkn_h2ZIqeKYTnHJiN4LVODfDBlJHy_KsW",
:auth_url => "http://m1.qbox.me:13001/oauth2/token",
@@ -14,5 +15,9 @@ RSpec.configure do |config|
:up_host => "http://m1.qbox.me:13019",
:pub_host => "http://m1.qbox.me:13012",
:eu_host => "http://m1.qbox.me:13050"
=end
Qiniu::RS.establish_connection! :access_key => "aPoWOtE9EFca1fLxFCtlkeZAOV7aADVMTLdSydmr",
:secret_key => "L3ShtjCQTCagVCDPfHJoOix7JO_o3qHz3ScyflUG"
end
end