summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/requests/post_refresh_tokens_spec.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/spec/requests/post_refresh_tokens_spec.rb b/spec/requests/post_refresh_tokens_spec.rb
index 836e340..5d8f8f0 100644
--- a/spec/requests/post_refresh_tokens_spec.rb
+++ b/spec/requests/post_refresh_tokens_spec.rb
@@ -15,10 +15,9 @@ RSpec.describe 'POST /api/refresh_tokens', type: :request do
context 'with an expired token' do
it 'returns an error message' do
- user.update_attribute(:session_key, SecureRandom.hex(16))
- service_params = { email: user.email, role: user.role, session_key: user.session_key }
- token = Services::TokenGenerationService.new(service_params).call(DateTime.current - 7.days)
- headers = { 'CONTENT_TYPE' => 'application/json', 'Authorization' => "Bearer #{token}" }
+ service_params = { email: user.email, role: user.role }
+ jwt = Services::TokenGenerationService.new(service_params).call(DateTime.current - 5.days)
+ headers = { 'CONTENT_TYPE' => 'application/json', 'Authorization' => "Bearer #{jwt[:refresh]}" }
post('/api/refresh_tokens', headers:)
expect(response).to have_http_status(401)
expect(response.body).to include('error_message')