Sha256: a0236bd7b88c369622e936625f2fda3aac6b5eb14d074899def4d0cd312231cc
Contents?: true
Size: 1.62 KB
Versions: 6
Compression:
Stored size: 1.62 KB
Contents
describe Commons::Errors::UnprocessableEntity 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.IER4222_unprocessable_entity.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