Sha256: 37b77ad0c150af768f1aafbfc4cf81ce58461470ce168068f6c9aaa70e04d933
Contents?: true
Size: 1.01 KB
Versions: 3
Compression:
Stored size: 1.01 KB
Contents
require 'spec_helper' describe MailRoom::CrashHandler do let(:error_message) { "oh noes!" } let(:error) { RuntimeError.new(error_message) } describe '#handle' do subject{ described_class.new(error: error, format: format) } context 'when given a json format' do let(:format) { 'json' } let(:fake_json) do { message: error_message }.to_json end it 'outputs the result of json to stdout' do subject.stubs(:json).returns(fake_json) expect{ subject.handle }.to output(/\"message\":\"#{error_message}\"/).to_stdout end end context 'when given a blank format' do let(:format) { "" } it 'raises an error as designed' do expect{ subject.handle }.to raise_error(error.class, error_message) end end context 'when given a nonexistent format' do let(:format) { "nonsense" } it 'raises an error as designed' do expect{ subject.handle }.to raise_error(error.class, error_message) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
gitlab-mail_room-0.0.4 | spec/lib/crash_handler_spec.rb |
gitlab-mail_room-0.0.3 | spec/lib/crash_handler_spec.rb |
gitlab-mail_room-0.0.2 | spec/lib/crash_handler_spec.rb |