Sha256: 2060030e792d44f786fa123fe90ef5b1a7b6db575cf617384f58fe034b570454

Contents?: true

Size: 888 Bytes

Versions: 1

Compression:

Stored size: 888 Bytes

Contents

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

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

    subject { Validation.new(server, request) }

    it 'is valid with valid request' do
      subject.should be_valid
    end

    it 'is invalid when client is not present' do
      request.stub :client => nil
      subject.should_not be_valid
    end

    context 'with scopes' do
      it 'is invalid when scopes are not included in the server' do
        server.stub :scopes => Doorkeeper::OAuth::Scopes.from_string('email')
        request.stub :original_scopes => 'invalid'
        subject.should_not be_valid
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
couchkeeper-0.6.7 spec/lib/oauth/client_credentials/validation_spec.rb