Sha256: d9a6e77054ffe9155acf74a207b5a933eba7b818ffeb773a5b45202c82e2b694

Contents?: true

Size: 1.05 KB

Versions: 45

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'
require 'active_support/core_ext/module/delegation'
require 'active_support/core_ext/object/blank'
require 'doorkeeper/oauth/scopes'
require 'doorkeeper/models/concerns/scopes'

describe 'Doorkeeper::Models::Scopes' do
  subject do
    Class.new(Hash) do
      include Doorkeeper::Models::Scopes
    end.new
  end

  before do
    subject[:scopes] = 'public admin'
  end

  describe :scopes do
    it 'is a `Scopes` class' do
      expect(subject.scopes).to be_a(Doorkeeper::OAuth::Scopes)
    end

    it 'includes scopes' do
      expect(subject.scopes).to include('public')
    end
  end

  describe :scopes_string do
    it 'is a `Scopes` class' do
      expect(subject.scopes_string).to eq('public admin')
    end
  end

  describe :includes_scope? do
    it 'should return true if at least one scope is included' do
      expect(subject.includes_scope?('public', 'private')).to be true
    end

    it 'should return false if no scopes are included' do
      expect(subject.includes_scope?('teacher', 'student')).to be false
    end
  end
end

Version data entries

45 entries across 45 versions & 3 rubygems

Version Path
doorkeeper-4.2.0 spec/lib/models/scopes_spec.rb
doorkeeper-4.1.0 spec/lib/models/scopes_spec.rb
doorkeeper-4.0.0 spec/lib/models/scopes_spec.rb
doorkeeper-4.0.0.rc4 spec/lib/models/scopes_spec.rb
doorkeeper-4.0.0.rc3 spec/lib/models/scopes_spec.rb
doorkeeper-4.0.0.rc2 spec/lib/models/scopes_spec.rb
doorkeeper-4.0.0.rc1 spec/lib/models/scopes_spec.rb
doorkeeper-3.1.0 spec/lib/models/scopes_spec.rb
doorkeeper-3.0.1 spec/lib/models/scopes_spec.rb
doorkeeper-2.2.2 spec/lib/models/scopes_spec.rb
doorkeeper-3.0.0 spec/lib/models/scopes_spec.rb
doorkeeper-3.0.0.rc2 spec/lib/models/scopes_spec.rb
doorkeeper-3.0.0.rc1 spec/lib/models/scopes_spec.rb
doorkeeper-2.2.1 spec/lib/models/scopes_spec.rb
doorkeeper-2.2.0 spec/lib/models/scopes_spec.rb
doorkeeper-2.1.4 spec/lib/models/scopes_spec.rb
doorkeeper-2.1.3 spec/lib/models/scopes_spec.rb
doorkeeper-2.1.2 spec/lib/models/scopes_spec.rb
doorkeeper-2.1.1 spec/lib/models/scopes_spec.rb
doorkeeper-2.1.0 spec/lib/models/scopes_spec.rb