From 41a17f47ae275f8e84de03115e142cc23526bacc Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Fri, 3 Mar 2023 20:34:06 -0600 Subject: AƱade refactorizaciones MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spec/requests/post_refresh_tokens_spec.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'spec') 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') -- cgit v1.2.3