<commit_before>require 'rails_helper'

describe Doorkeeper::OpenidConnect::UserinfoController, type: :controller do
  let(:client) { create :application }
  let(:user)   { User.create! name: 'Joe', password: '<PASSWORD>' }
  let(:token)  { create :access_token, application: client, resource_owner_id: user.id }

  describe '#show' do
    context 'with a valid access token authorized for the openid scope' do
      let(:token) { create :access_token, application: client, resource_owner_id: user.id, scopes: 'openid' }

      it 'returns the user information as JSON' do
        get :show, access_token: token.token

        expect(response.status).to eq 200
        expect(response.body).to eq %Q{{"sub":"#{user.id}","name":"Joe"}}
      end
    end<commit_msg>chore: Use user factory in spec<commit_after>require 'rails_helper'

describe Doorkeeper::OpenidConnect::UserinfoController, type: :controller do
  let(:client) { create :application }
  let(:user)   { create :user, name: 'Joe' }
  let(:token)  { create :access_token, application: client, resource_owner_id: user.id }

  describe '#show' do
    context 'with a valid access token authorized for the openid scope' do
      let(:token) { create :access_token, application: client, resource_owner_id: user.id, scopes: 'openid' }

      it 'returns the user information as JSON' do
        get :show, access_token: token.token

        expect(response.status).to eq 200
        expect(response.body).to eq %Q{{"sub":"#{user.id}","name":"Joe"}}
      end
    end
{'fraction_non_alphanumeric': 0.12689020381328073, 'fraction_numerical': 0.0039447731755424065, 'mean_word_length': 4.073333333333333, 'pattern_counts': {'":': 4, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5564616', 'n_tokens_mistral': 470, 'n_tokens_neox': 451, 'n_words': 137}