Sha256: 82f7bd8d90b6f108035ea1c46290488ef9a3ad870c0437737a0f136ecf37ad66
Contents?: true
Size: 1.61 KB
Versions: 6
Compression:
Stored size: 1.61 KB
Contents
describe Commons::Errors::Unauthorized do describe 'handle_error' do context 'works with no message or validation_errors' do it do expect do raise described_class end.to raise_error(described_class) end end context 'default values works ok' do subject { described_class.new } it do expect do raise subject end.to raise_error(described_class) end it { expect(subject.detail).to eq I18n.t('status_code.IER4002_unauthorized.detail') } end context 'works with message but no validation_errors' do let(:message) { 'my totally non-existent message' } subject { described_class.new(message) } it do expect do raise subject end.to raise_error(described_class) end it { expect(subject.message).to eq message } end context 'works with message & validation_errors' do let(:message) { 'my totally non-existent message' } let(:detail) { { errors: 'my totally non-existent error' } } subject { described_class.new(message, nil, detail: detail) } it do expect do raise subject end.to raise_error(described_class) end it { expect(subject.detail).to eq detail } end context 'works with message & backtrace' do let(:message) { 'my totally non-existent message' } subject { described_class.new(message, [message]) } it do expect do raise subject end.to raise_error(described_class) end it { expect(subject.backtrace).to eq [message] } end end end
Version data entries
6 entries across 6 versions & 1 rubygems