Sha256: 15a376f1034ae892ca9a727f77bb6f994f2e49e4d441253337853f9747cc002a

Contents?: true

Size: 865 Bytes

Versions: 2

Compression:

Stored size: 865 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
      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

2 entries across 2 versions & 1 rubygems

Version Path
doorkeeper-1.0.0.rc2 spec/lib/oauth/client_credentials/validation_spec.rb
doorkeeper-1.0.0.rc1 spec/lib/oauth/client_credentials/validation_spec.rb