Sha256: 6eba2c772dbe1e333a84769d73c91729c4c1910ad3370561cdaaef6841da29c5

Contents?: true

Size: 947 Bytes

Versions: 3

Compression:

Stored size: 947 Bytes

Contents

require 'tango/error'

describe Tango::Error do
  describe '.from_status_code' do
    context 'when status code is 404' do
      subject { Tango::Error.from_status_code(404) }
      its(:message) { should == 'Error: 404' }
    end
  end
end

describe Tango::Error::ServerError do
  describe '.from_response' do
    context 'when responseType is Unknown' do
      subject {
        Tango::Error::ServerError.from_response(:responseType => 'Unknown',
                                                :response => 'test')
      }

      it { should be_a_kind_of(Tango::Error::ServerError) }
      its(:response) { should == 'test' }
    end
    context 'when responseType is INV_CREDENTIAL' do
      subject {
        Tango::Error::ServerError.from_response(:responseType => 'INV_CREDENTIAL',
                                                :response => 'test')
      }

      it { should be_a_kind_of(Tango::Error::InvCredential) }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tango-client-1.0.2 spec/tango/error_spec.rb
tango-client-1.0.1 spec/tango/error_spec.rb
tango-client-1.0.0 spec/tango/error_spec.rb