Sha256: 657175635d6f300efeee04055d38e9703540773849896695e4c8ff585fcf9aa0
Contents?: true
Size: 1.27 KB
Versions: 15
Compression:
Stored size: 1.27 KB
Contents
require 'spec_helper' describe Freddy::ErrorResponse do subject(:error) { described_class.new(input) } context 'with an error type' do let(:input) { { error: 'SomeError' } } describe '#response' do subject { error.response } it { is_expected.to eq(input) } end describe '#message' do subject(:message) { error.message } it 'uses error type as a message' do expect(message).to eq('SomeError') end end end context 'with an error type and message' do let(:input) { { error: 'SomeError', message: 'extra info' } } describe '#response' do subject { error.response } it { is_expected.to eq(input) } end describe '#message' do subject(:message) { error.message } it 'uses error type as a message' do expect(message).to eq('SomeError: extra info') end end end context 'without an error type' do let(:input) { { something: 'else' } } describe '#response' do subject { error.response } it { is_expected.to eq(input) } end describe '#message' do subject(:message) { error.message } it 'uses default error message as a message' do expect(message).to eq('Use #response to get the error response') end end end end
Version data entries
15 entries across 15 versions & 1 rubygems