Sha256: 0266a07c61168c74fa510231d2c4784726b145353555ca0c75f2d07780606b28

Contents?: true

Size: 1.69 KB

Versions: 9

Compression:

Stored size: 1.69 KB

Contents

require File.expand_path('../spec_helper', __FILE__)

describe Yammer::Error do

  subject { Yammer::Error }

  describe 'from status' do

    context 'status unknown' do
      it 'returns ApiError' do
        expect(subject.from_status).to eq Yammer::Error::ApiError
      end
    end

    context 'status 400' do
      it 'returns BadRequest' do
        expect(subject.from_status(400)).to eq Yammer::Error::BadRequest
      end
    end

    context 'status 401' do
      it 'returns Unauthorized' do
        expect(subject.from_status(401)).to eq Yammer::Error::Unauthorized 
      end
    end

    context 'status 403' do
      it 'returns Forbidden' do
        expect(subject.from_status(403)).to eq Yammer::Error::Forbidden
      end
    end 

    context 'status 404' do
      it 'returns NotFound' do
        expect(subject.from_status(404)).to eq Yammer::Error::NotFound
      end
    end

    context 'status 406' do
      it 'returns NotAcceptable' do
        expect(subject.from_status(406)).to eq Yammer::Error::NotAcceptable
      end
    end

    context 'status 429' do
      it 'returns RateLimitExceeded' do
        expect(subject.from_status(429)).to eq Yammer::Error::RateLimitExceeded
      end
    end

    context 'status 500' do
      it 'returns InternalServerError' do
        expect(subject.from_status(500)).to eq Yammer::Error::InternalServerError
      end
    end

    context 'status 502' do
      it 'returns BadGateway' do
        expect(subject.from_status(502)).to eq Yammer::Error::BadGateway
      end
    end

    context 'status 503' do
      it 'returns ServiceUnavailable' do
        expect(subject.from_status(503)).to eq Yammer::Error::ServiceUnavailable
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
yammer-client-0.1.8 spec/error_spec.rb
yammer-client-0.1.7 spec/error_spec.rb
yammer-client-0.1.6 spec/error_spec.rb
yammer-client-0.1.5 spec/error_spec.rb
yammer-client-0.1.4 spec/error_spec.rb
yammer-client-0.1.3 spec/error_spec.rb
yammer-client-0.1.2 spec/error_spec.rb
yammer-client-0.1.1 spec/error_spec.rb
yammer-client-0.1.0 spec/error_spec.rb