Sha256: 48ec458566637a941988f535eb95e0a9e16c0743086cdeaab32a97d822d45db8

Contents?: true

Size: 425 Bytes

Versions: 8

Compression:

Stored size: 425 Bytes

Contents

require 'spec_helper'

describe Aptible::Resource::Base do
  it 'throws errors with a useful message' do
    href = 'https://resource.example.com/mainframes/1'
    body = { 'error' => 'unprocessable_entity', message: 'This is all wrong' }
    stub_request(:get, href).to_return(body: JSON.unparse(body), status: 422)

    expect { Api::Mainframe.find(1) }
      .to raise_error(/unprocessable_entity.*all wrong/im)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
aptible-resource-1.1.2 spec/aptible/errors_spec.rb
aptible-resource-1.1.1 spec/aptible/errors_spec.rb
aptible-resource-1.1.0 spec/aptible/errors_spec.rb
aptible-resource-1.1.0.pre.0 spec/aptible/errors_spec.rb
aptible-resource-1.0.2 spec/aptible/errors_spec.rb
aptible-resource-1.0.1 spec/aptible/errors_spec.rb
aptible-resource-1.0.0 spec/aptible/errors_spec.rb
aptible-resource-0.5.0 spec/aptible/errors_spec.rb