Sha256: d4b3e8f6259ee7d7239ab139c2151a327bd88cb90312a92efb2948a8585aa0da
Contents?: true
Size: 1.39 KB
Versions: 20
Compression:
Stored size: 1.39 KB
Contents
require 'spec_helper' RSpec.describe RDStation::ErrorHandler::InvalidCredentials do describe '#raise_error' do subject(:invalid_credentials_error) { described_class.new(errors) } context 'when there are invalid credentials errors' do let(:errors) do [ { 'error_message' => 'Error Message', 'error_type' => 'ACCESS_DENIED' } ] end it 'raises an InvalidCredentials error' do expect do invalid_credentials_error.raise_error end.to raise_error(RDStation::Error::InvalidCredentials, 'Error Message') end end context 'when none of the errors are invalid credentials 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 InvalidCredentials error' do result = invalid_credentials_error.raise_error expect(result).to be_nil end end context 'when there are no errors' do let(:errors) { [] } it 'does not raise an InvalidCredentials error' do result = invalid_credentials_error.raise_error expect(result).to be_nil end end end end
Version data entries
20 entries across 20 versions & 1 rubygems