Sha256: 54c4a1c233c84842350234dc59907c8b75ab7628783a16d75bdc3a7ae954311f

Contents?: true

Size: 819 Bytes

Versions: 1

Compression:

Stored size: 819 Bytes

Contents

require 'rest-more/test'

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

  should '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

  should '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

1 entries across 1 versions & 1 rubygems

Version Path
rest-more-3.1.0 test/dropbox/test_dropbox.rb