Sha256: 630f39dda44cd2d2f9349bc26d757ec94911ec452e745cae568a92f2c52048a5
Contents?: true
Size: 845 Bytes
Versions: 6
Compression:
Stored size: 845 Bytes
Contents
require 'rest-more/test' describe RC::Twitter do after do WebMock.reset! end would 'get right' do stub_request(:get, 'https://api.twitter.com/1.1/account/verify_credentials.json'). to_return(:body => '{"status": "OK"}') RC::Twitter.new.me.should.eq({'status' => 'OK'}) end def check status, klass stub_request(:delete, 'https://api.twitter.com/123').to_return( :body => '{}', :status => status) lambda{ RC::Twitter.new.delete('123').tap{} }.should.raise(klass) WebMock.reset! end would '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
6 entries across 6 versions & 1 rubygems