Sha256: d714b9bcb15fd6c2809bbf1f51b51936120c73956f486256bf0c3230dcbf3d60

Contents?: true

Size: 1.53 KB

Versions: 9

Compression:

Stored size: 1.53 KB

Contents

require 'spec_helper'

describe BitBucket::Response::RaiseError do
  describe '.on_complete' do
    before do
      @raise_error = BitBucket::Response::RaiseError.new
    end

    it 'raises a BadRequest error on 400 status code' do
      expect{ @raise_error.on_complete({status: 400}) }.to raise_error BitBucket::Error::BadRequest
    end

    it 'raises an Unauthorized error on 401 status code' do
      expect{ @raise_error.on_complete({status: 401}) }.to raise_error BitBucket::Error::Unauthorized
    end

    it 'raises a Forbidden error on 403 status code' do
      expect{ @raise_error.on_complete({status: 403}) }.to raise_error BitBucket::Error::Forbidden
    end

    it 'raises a NotFound error on 404 status code' do
      expect{ @raise_error.on_complete({status: 404}) }.to raise_error BitBucket::Error::NotFound
    end

    it 'raises an UnprocessableEntity error on 422 status code' do
      expect{ @raise_error.on_complete({status: 422}) }.to raise_error BitBucket::Error::UnprocessableEntity
    end

    it 'raises an InternalServerError error on 500 status code' do
      expect{ @raise_error.on_complete({status: 500}) }.to raise_error BitBucket::Error::InternalServerError
    end

    it 'raises a ServiceUnavailable error on 503 status code' do
      expect{ @raise_error.on_complete({status: 503}) }.to raise_error BitBucket::Error::ServiceUnavailable
    end

    it 'raises a ServiceError when another status code' do
      expect{ @raise_error.on_complete({status: 501}) }.to raise_error BitBucket::Error::ServiceError
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
zz_bitbucket_rest_api-0.1.11 spec/bitbucket_rest_api/response/raise_error_spec.rb
zz_bitbucket_rest_api-0.1.10 spec/bitbucket_rest_api/response/raise_error_spec.rb
zz_bitbucket_rest_api-0.1.9 spec/bitbucket_rest_api/response/raise_error_spec.rb
zz_bitbucket_rest_api-0.1.8 spec/bitbucket_rest_api/response/raise_error_spec.rb
bitbucket_rest_api2-0.9.5 spec/bitbucket_rest_api/response/raise_error_spec.rb
bitbucket_rest_api2-0.9.1 spec/bitbucket_rest_api/response/raise_error_spec.rb
bitbucket_rest_api2-0.2.2 spec/bitbucket_rest_api/response/raise_error_spec.rb
bitbucket_rest_api2-0.2.1 spec/bitbucket_rest_api/response/raise_error_spec.rb
bitbucket_rest_api2-0.2.0 spec/bitbucket_rest_api/response/raise_error_spec.rb