Sha256: 39cc02ffd8bfcf7c262e12859f8e98f5ce09a777b4467c1cc3a4c6adcf66fde9

Contents?: true

Size: 752 Bytes

Versions: 5

Compression:

Stored size: 752 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"

RSpec.describe Doorkeeper::OAuth::ClientCredentialsRequest do
  let(:server) { Doorkeeper.configuration }

  context "with a valid request" do
    let(:client) { Doorkeeper::OAuth::Client.new(FactoryBot.build_stubbed(:application)) }

    it "issues an access token" do
      request = described_class.new(server, client, {})
      expect do
        request.authorize
      end.to change { Doorkeeper::AccessToken.count }.by(1)
    end
  end

  describe "with an invalid request" do
    it "does not issue an access token" do
      request = described_class.new(server, nil, {})
      expect do
        request.authorize
      end.not_to(change { Doorkeeper::AccessToken.count })
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
doorkeeper-mongodb-5.3.0 spec/lib/oauth/client_credentials_integration_spec.rb
doorkeeper-mongodb-5.2.3 spec/lib/oauth/client_credentials_integration_spec.rb
doorkeeper-sequel-2.4.0 spec/lib/oauth/client_credentials_integration_spec.rb
doorkeeper-mongodb-5.2.2 spec/lib/oauth/client_credentials_integration_spec.rb
doorkeeper-sequel-2.3.0 spec/lib/oauth/client_credentials_integration_spec.rb