Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Thource committed Feb 13, 2024
1 parent ee00f6b commit 5694334
Showing 1 changed file with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,17 @@
require 'rails_helper'

RSpec.describe SubjectAccessRequestsController do
let(:access_token) { 'spoofed-token' }
let(:headers) { { 'CONTENT_TYPE': content_type }.merge('Authorization' => "Bearer #{access_token}") }
let(:response_json) { JSON.parse(response.body) }
let(:content_type) { ApiController::CONTENT_TYPE }

describe 'GET /subject-access-request' do
subject(:get_sar) { get '/subject-access-request', params:, headers: }

let(:schema) { load_yaml_schema('get_subject_access_request_responses.yaml') }
let(:params) { {} }
let(:application) { Doorkeeper::Application.create(name: 'test') }
let(:doorkeeper_token) { Doorkeeper::AccessToken.create(application:, scopes: 'subject-access-request') }

before do
allow(controller).to receive(:doorkeeper_token).and_return(doorkeeper_token)
end
let(:access_token) { doorkeeper_token.token }
let(:headers) { { 'CONTENT_TYPE': content_type }.merge('Authorization' => "Bearer #{access_token}") }
let(:response_json) { JSON.parse(response.body) }
let(:content_type) { ApiController::CONTENT_TYPE }

context 'when the token is missing the subject-access-request scope' do
let(:doorkeeper_token) { Doorkeeper::AccessToken.create(application:) }
Expand Down

0 comments on commit 5694334

Please sign in to comment.