Sha256: f6148ae8fe2ecabf5b90de440065f0a108c27323fdc10e62bcbb765c3e864274

Contents?: true

Size: 800 Bytes

Versions: 6

Compression:

Stored size: 800 Bytes

Contents

require 'rest-more/test'

describe RC::Dropbox do
  after do
    WebMock.reset!
  end

  would 'get right' do
    stub_request(:get, 'https://api.dropbox.com/1/account/info').
      to_return(:body => '{"status": "OK"}')

    RC::Dropbox.new.me.should.eq({'status' => 'OK'})
  end

  def check status, klass
    stub_request(:delete, 'https://api.dropbox.com/123').to_return(
      :body => '{}', :status => status)

    lambda{
      RC::Dropbox.new.delete('123').tap{}
    }.should.raise(klass)

    WebMock.reset!
  end

  would 'raise exception when encountering error' do
    [401, 402, 403].each{ |status| check(status, RC::Dropbox::Error) }
    [500, 502, 503].each{ |status| check(status, RC::Dropbox::Error::
                                                 ServerError)        }
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rest-more-3.4.0 test/dropbox/test_dropbox.rb
rest-more-3.3.4 test/dropbox/test_dropbox.rb
rest-more-3.3.3 test/dropbox/test_dropbox.rb
rest-more-3.3.2 test/dropbox/test_dropbox.rb
rest-more-3.3.1 test/dropbox/test_dropbox.rb
rest-more-3.3.0 test/dropbox/test_dropbox.rb