Sha256: 0ecf95fce9fd3303c213fe571f42350b84e9f2b325e91af6029771cdceeee9c0
Contents?: true
Size: 822 Bytes
Versions: 17
Compression:
Stored size: 822 Bytes
Contents
require 'spec_helper' describe Locomotive::Coal::Error do let(:status) { nil } let(:body) { {} } let(:response) { instance_double('Response', status: status, body: body) } let(:error) { described_class.from_response(response) } describe '#message' do subject { error.message } context 'error caused by a wrong answer from the server' do context 'invalid resource (422)' do let(:status) { 422 } let(:body) { { 'error' => 'Resource invalid', 'attributes' => { 'name' => ["can't be blank"] } } } it { is_expected.to eq "Resource invalid: name can't be blank" } end context 'Request Entity Too Large (413)' do let(:status) { 413 } it { is_expected.to eq "File too big for the server" } end end end end
Version data entries
17 entries across 17 versions & 1 rubygems