Sha256: 19c793eba3823cd6ef3e126929e1f49bf048f4e1b70a76c67991dc8ffda7a97a
Contents?: true
Size: 1.32 KB
Versions: 4
Compression:
Stored size: 1.32 KB
Contents
require 'spec_helper' RSpec.describe RDStation::ErrorHandler::Unauthorized do describe '#raise_error' do subject(:unauthorized_error) { described_class.new(errors) } context 'when there is an unauthorized error' do let(:errors) do [ { 'error_message' => 'Error Message', 'error_type' => 'UNAUTHORIZED' } ] end it 'raises an Unauthorized error' do expect do unauthorized_error.raise_error end.to raise_error(RDStation::Error::Unauthorized, 'Error Message') end end context 'when none of the errors are unauthorized errors' do let(:errors) do [ { 'error_message' => 'Error Message', 'error_type' => 'RANDOM_ERROR_TYPE' }, { 'error_message' => 'Another Error Message', 'error_type' => 'ANOTHER_RANDOM_ERROR_TYPE' } ] end it 'does not raise an Unauthorized error' do result = unauthorized_error.raise_error expect(result).to be_nil end end context 'when there are no errors' do let(:errors) { [] } it 'does not raise an Unauthorized error' do result = unauthorized_error.raise_error expect(result).to be_nil end end end end
Version data entries
4 entries across 4 versions & 1 rubygems