Sha256: a2623703326f45ab622b4e1b57fbdf1954ea2a048db869f5e4c691ce436e18b7

Contents?: true

Size: 1.38 KB

Versions: 20

Compression:

Stored size: 1.38 KB

Contents

require 'spec_helper'

RSpec.describe RDStation::ErrorHandler::ExpiredCodeGrant do
  describe '#raise_error' do

    subject(:expired_code_grant_error) { described_class.new(errors) }

    context 'when there is an expired code grant error' do
      let(:errors) do
        [
          {
            'error_message' => 'Error Message',
            'error_type' => 'EXPIRED_CODE_GRANT'
          }
        ]
      end

      it 'raises an ExpiredCodeGrant error' do
        expect do
          expired_code_grant_error.raise_error
        end.to raise_error(RDStation::Error::ExpiredCodeGrant, 'Error Message')
      end
    end

    context 'when none of the errors are expired code grant 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 ExpiredCodeGrant error' do
        result = expired_code_grant_error.raise_error
        expect(result).to be_nil
      end
    end

    context 'when there are no errors' do
      let(:errors) { [] }

      it 'does not raise an ExpiredCodeGrant error' do
        result = expired_code_grant_error.raise_error
        expect(result).to be_nil
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
rdstation-ruby-client-2.9.0 spec/lib/rdstation/error_handler/expired_code_grant_spec.rb
rdstation-ruby-client-2.8.2 spec/lib/rdstation/error_handler/expired_code_grant_spec.rb
rdstation-ruby-client-2.8.1 spec/lib/rdstation/error_handler/expired_code_grant_spec.rb
rdstation-ruby-client-2.8.0 spec/lib/rdstation/error_handler/expired_code_grant_spec.rb
rdstation-ruby-client-2.7.0 spec/lib/rdstation/error_handler/expired_code_grant_spec.rb
rdstation-ruby-client-2.6.0 spec/lib/rdstation/error_handler/expired_code_grant_spec.rb
rdstation-ruby-client-2.5.3 spec/lib/rdstation/error_handler/expired_code_grant_spec.rb
rdstation-ruby-client-2.5.2 spec/lib/rdstation/error_handler/expired_code_grant_spec.rb
rdstation-ruby-client-2.5.1 spec/lib/rdstation/error_handler/expired_code_grant_spec.rb
rdstation-ruby-client-2.5.0 spec/lib/rdstation/error_handler/expired_code_grant_spec.rb
rdstation-ruby-client-2.4.0 spec/lib/rdstation/error_handler/expired_code_grant_spec.rb
rdstation-ruby-client-2.3.1 spec/lib/rdstation/error_handler/expired_code_grant_spec.rb
rdstation-ruby-client-2.3.0 spec/lib/rdstation/error_handler/expired_code_grant_spec.rb
rdstation-ruby-client-2.2.0 spec/lib/rdstation/error_handler/expired_code_grant_spec.rb
rdstation-ruby-client-2.1.0 spec/lib/rdstation/error_handler/expired_code_grant_spec.rb
rdstation-ruby-client-2.0.0 spec/lib/rdstation/error_handler/expired_code_grant_spec.rb
rdstation-ruby-client-1.2.1 spec/lib/rdstation/error_handler/expired_code_grant_spec.rb
rdstation-ruby-client-1.2.0 spec/lib/rdstation/error_handler/expired_code_grant_spec.rb
rdstation-ruby-client-1.1.0 spec/lib/rdstation/error_handler/expired_code_grant_spec.rb
rdstation-ruby-client-1.0.1 spec/lib/rdstation/error_handler/expired_code_grant_spec.rb