Sha256: 17f953e4993a44e0f276ed4ddb81d43240189fc844fe4514ccd2fb1bfcb5b52b
Contents?: true
Size: 995 Bytes
Versions: 6
Compression:
Stored size: 995 Bytes
Contents
RSpec.describe Commons::Authentication::AuthenticateByJWT, type: :request do describe 'when calling /misc/application_parameters' do context 'raises error as an unauthenticated user' do subject do get "/misc/application_parameters", params: {}.to_json, headers: { 'content-type': 'application/json' } response end it do is_expected.to have_http_status(:unauthorized) end end context 'works ok as an authenticated user' do let(:user) { create(:user) } let(:jwt) { Commons::Authentication::JSONWebToken.encode(user_id: user.id) } subject do get "/misc/application_parameters", params: {}.to_json, headers: { 'content-type': 'application/json', 'Authorization': 'Bearer ' + jwt } response end it do is_expected.to have_http_status(:ok) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems