Sha256: 9be8965bc8d7db1d2fa10f7aebf8ba6acd4adff5d8bf5e5d3b884150844910df

Contents?: true

Size: 867 Bytes

Versions: 5

Compression:

Stored size: 867 Bytes

Contents

describe Mrkt::Authentication do
  include_context 'initialized client'

  describe '#authenticate' do
    subject { client.authenticate }

    context 'on a successful response' do
      it { is_expected.to be_success }
    end

    context 'when the token is invalid' do
      let(:authentication_stub) do
        {
          error: 'invalid_client',
          error_description: 'Bad client credentials'
        }
      end

      it 'should raise an Error' do
        expect { subject }.to raise_error(Mrkt::Errors::Error, 'Bad client credentials')
      end
    end
  end

  describe '#authenticated?' do
    subject { client.authenticated? }

    context 'before authentication' do
      it { is_expected.to be_falsey }
    end

    context 'after authentication' do
      before { client.authenticate }

      it { is_expected.to be_truthy }
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mrkt-0.6.2 spec/concerns/authentication_spec.rb
mrkt-0.6.1 spec/concerns/authentication_spec.rb
mrkt-0.6.0 spec/concerns/authentication_spec.rb
mrkt-0.5.0 spec/concerns/authentication_spec.rb
mrkt-0.4.0 spec/concerns/authentication_spec.rb