Sha256: 3cfd34364adceaf93e44f09492a9d17abd12db0be93368572b193e42d9d7f56a
Contents?: true
Size: 799 Bytes
Versions: 8
Compression:
Stored size: 799 Bytes
Contents
require 'rest-core/test' describe RestCore::Twitter do after do WebMock.reset! RR.verify end should 'get right' do stub_request(:get, 'https://api.twitter.com/me'). to_return(:body => '{"status": "OK"}') RestCore::Twitter.new.get('me').should.eq({'status' => 'OK'}) end def check status, klass stub_request(:delete, 'https://api.twitter.com/123').to_return( :body => '{}', :status => status) lambda{ RestCore::Twitter.new.delete('123') }.should.raise(klass) WebMock.reset! end should 'raise exception when encountering error' do [401, 402, 403].each{ |status| check(status, RestCore::Twitter::Error) } [500, 502, 503].each{ |status| check(status, RestCore::Twitter::Error::ServerError) } end end
Version data entries
8 entries across 8 versions & 2 rubygems