Sha256: 264d10ff422d51fd629be2794363e5e486eb5f7aef3b7fd5a7052d5a75d9d485

Contents?: true

Size: 1.21 KB

Versions: 12

Compression:

Stored size: 1.21 KB

Contents

require 'rails_helper'

# Engine.rb automatically includes the mixin

RSpec.describe Doorkeeper::AccessToken, :type => :model do
  describe "associations" do
    it { is_expected.to have_one(:sso_client).class_name('Sso::Client').with_foreign_key(:access_token_id) }
  end

  describe "assignment" do
    let(:user) { Fabricate(:user) }
    let(:application) { Fabricate('Doorkeeper::Application') }
    let(:access_token) { Fabricate('Doorkeeper::AccessToken',
                                   resource_owner_id: user.id) }
    let(:access_grant) { Fabricate('Doorkeeper::AccessGrant',
                                   application_id: application.id,
                                   resource_owner_id: user.id,
                                   redirect_uri: 'http://localhost:3002/oauth/callback'
                                  ) }

    let(:session) {  Fabricate('Sso::Session', owner: user) }
    let!(:client) {  Fabricate('Sso::Client', session: session,
                                  application_id: application.id,
                                  access_token_id: access_token.id,
                                  access_grant_id: access_grant.id) }

    it { expect(access_token.sso_client).to eq client }
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
doorkeeper_sso-0.4.9 spec/lib/doorkeeper/access_token_mixin_spec.rb
doorkeeper_sso-0.4.8 spec/lib/doorkeeper/access_token_mixin_spec.rb
doorkeeper_sso-0.4.6 spec/lib/doorkeeper/access_token_mixin_spec.rb
doorkeeper_sso-0.4.3 spec/lib/doorkeeper/access_token_mixin_spec.rb
doorkeeper_sso-0.4.1 spec/lib/doorkeeper/access_token_mixin_spec.rb
doorkeeper_sso-0.4.0 spec/lib/doorkeeper/access_token_mixin_spec.rb
doorkeeper_sso-0.2.7 spec/lib/doorkeeper/access_token_mixin_spec.rb
doorkeeper_sso-0.2.6 spec/lib/doorkeeper/access_token_mixin_spec.rb
doorkeeper_sso-0.2.5 spec/lib/doorkeeper/access_token_mixin_spec.rb
doorkeeper_sso-0.2.3 spec/lib/doorkeeper/access_token_mixin_spec.rb
doorkeeper_sso-0.2.2 spec/lib/doorkeeper/access_token_mixin_spec.rb
doorkeeper_sso-0.2.0 spec/lib/doorkeeper/access_token_mixin_spec.rb