File: factories.rb

package info (click to toggle)
ruby-doorkeeper-openid-connect 1.7.4-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 648 kB
  • sloc: ruby: 2,915; makefile: 7; sh: 4
file content (35 lines) | stat: -rw-r--r-- 871 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# frozen_string_literal: true

FactoryBot.define do
  factory :access_grant, class: 'Doorkeeper::AccessGrant' do
    resource_owner_id { create(:user).id }
    application
    redirect_uri { 'https://app.com/callback' }
    expires_in { 100 }
    scopes { 'public write' }
  end

  factory :access_token, class: 'Doorkeeper::AccessToken' do
    resource_owner_id { create(:user).id }
    application
    expires_in { 2.hours }

    factory :clientless_access_token do
      application { nil }
    end
  end

  factory :application, class: 'Doorkeeper::Application' do
    sequence(:name) { |n| "Application #{n}" }
    redirect_uri { 'https://app.com/callback' }
  end

  factory :user do
    current_sign_in_at { Time.zone.at(23) }
  end

  factory :openid_request, class: 'Doorkeeper::OpenidConnect::Request' do
    access_grant
    sequence(:nonce, &:to_s)
  end
end