summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorHombreLaser <sebastian-440@live.com>2023-03-03 20:34:06 -0600
committerHombreLaser <sebastian-440@live.com>2023-03-03 20:34:06 -0600
commit41a17f47ae275f8e84de03115e142cc23526bacc (patch)
tree2fb62f78685698a7c55bf5cff8456d24b7a78361 /spec
parent094ee717f710ea4cf81d221c5bf9660b805da9b1 (diff)
Añade refactorizaciones
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')