Sha256: a26b777a9cfb10816a19a30686641c94918dd236993e2dba02919aecf77d5db8

Contents?: true

Size: 763 Bytes

Versions: 7

Compression:

Stored size: 763 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"

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

  context "with a valid request" do
    let(:client) { FactoryBot.create :application }

    it "issues an access token" do
      request = Doorkeeper::OAuth::ClientCredentialsRequest.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 = Doorkeeper::OAuth::ClientCredentialsRequest.new(server, nil, {})
      expect do
        request.authorize
      end.to_not(change { Doorkeeper::AccessToken.count })
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
doorkeeper-5.3.3 spec/lib/oauth/client_credentials_integration_spec.rb
doorkeeper-5.3.2 spec/lib/oauth/client_credentials_integration_spec.rb
doorkeeper-5.4.0.rc1 spec/lib/oauth/client_credentials_integration_spec.rb
doorkeeper-mongodb-5.2.1 spec/lib/oauth/client_credentials_integration_spec.rb
doorkeeper-mongodb-5.2.0 spec/lib/oauth/client_credentials_integration_spec.rb
doorkeeper-5.3.1 spec/lib/oauth/client_credentials_integration_spec.rb
doorkeeper-5.3.0 spec/lib/oauth/client_credentials_integration_spec.rb