summaryrefslogtreecommitdiff
path: root/spec/requests/authentications_spec.rb
blob: 6b33402d12a6c97b6cd07d1e3f714bf784e15f6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe 'POST /api/authenticate', type: :request do
  it_behaves_like 'a POST request' do
    let(:headers) { { 'CONTENT_TYPE' => 'application/json' } }
    let(:route) { '/api/authenticate' }
    let(:expected_error_messages) { ['Credenciales incorrectas'] }
    let(:desired_error_status) { 401 }
    let(:expected_text) { %w[token refresh] }
    let(:user) { create(:user_account) }
    let(:params) { { credentials: { email: user.email, password: user.password } } }
    let(:wrong_params) { { credentials: { email: user.email, password: 'wrong_password' } } }
  end
end