Sha256: 45825d6b9b01f1c8ed896d9d5ebbc033f935f3ebdff2fcc75902edc95ad9e719

Contents?: true

Size: 937 Bytes

Versions: 11

Compression:

Stored size: 937 Bytes

Contents

require 'spec_helper'
require 'active_support/all'
require 'doorkeeper/oauth/client_credentials/validation'

class Doorkeeper::OAuth::ClientCredentialsRequest
  describe Validation do
    let(:server)  { double :server, scopes: nil }
    let(:request) { double :request, client: double, original_scopes: nil }

    subject { Validation.new(server, request) }

    it 'is valid with valid request' do
      expect(subject).to be_valid
    end

    it 'is invalid when client is not present' do
      allow(request).to receive(:client).and_return(nil)
      expect(subject).not_to be_valid
    end

    context 'with scopes' do
      it 'is invalid when scopes are not included in the server' do
        allow(server).to receive(:scopes).and_return(Doorkeeper::OAuth::Scopes.from_string('email'))
        allow(request).to receive(:original_scopes).and_return('invalid')
        expect(subject).not_to be_valid
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
doorkeeper-1.4.2 spec/lib/oauth/client_credentials/validation_spec.rb
doorkeeper-2.0.1 spec/lib/oauth/client_credentials/validation_spec.rb
doorkeeper-1.4.1 spec/lib/oauth/client_credentials/validation_spec.rb
doorkeeper-2.0.0 spec/lib/oauth/client_credentials/validation_spec.rb
doorkeeper-2.0.0.rc3 spec/lib/oauth/client_credentials/validation_spec.rb
doorkeeper-2.0.0.rc2 spec/lib/oauth/client_credentials/validation_spec.rb
doorkeeper-2.0.0.alpha1 spec/lib/oauth/client_credentials/validation_spec.rb
doorkeeper-1.4.0 spec/lib/oauth/client_credentials/validation_spec.rb
doorkeeper-1.3.1 spec/lib/oauth/client_credentials/validation_spec.rb
doorkeeper-1.3.0 spec/lib/oauth/client_credentials/validation_spec.rb
doorkeeper-1.2.0 spec/lib/oauth/client_credentials/validation_spec.rb