Sha256: 231ac188ae84404a1eae5d919795a1ce8cbce149cba631a749ced8a2608c78b5
Contents?: true
Size: 1004 Bytes
Versions: 9
Compression:
Stored size: 1004 Bytes
Contents
# frozen_string_literal: true require 'spec_helper' RSpec.describe Scimaenaga::ScimSchemasController, type: :request do let(:company) { create(:company) } let(:credentials) do Base64.encode64("#{company.subdomain}:#{company.api_token}") end let(:authorization) { "Basic #{credentials}" } def get_request(content_type = 'application/scim+json') get '/scim/v2/Schemas', headers: { Authorization: authorization, 'Content-Type': content_type, } end context 'OAuth Bearer Authorization' do context 'with valid token' do let(:authorization) { "Bearer #{company.api_token}" } it 'supports OAuth bearer authorization and succeeds' do get_request expect(response.status).to eq 200 end end context 'with invalid token' do let(:authorization) { "Bearer #{SecureRandom.hex}" } it 'The request fails' do get_request expect(response.status).to eq 401 end end end end
Version data entries
9 entries across 9 versions & 1 rubygems