summaryrefslogtreecommitdiff
path: root/spec/requests/user_accounts_controller/create_user_accounts_spec.rb
blob: a45e02b5d92d7259f2e6572abbe618b091790db6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe 'POST /api/user_accounts', type: :request do
  it_behaves_like 'a POST request' do
    let(:headers) { {} }
    let(:route) { '/api/user_accounts' }
    let(:expected_error_messages) do
      ["Password can't be blank", 'Email is invalid', "First name can't be blank", "Last name can't be blank"]
    end
    let(:desired_error_status) { 422 }
    let(:expected_text) { %w[token refresh] }
    let(:user) { build(:user_account) }
    let(:params) do
      { email: user.email, password: user.password,
        first_name: user.first_name, last_name: user.last_name }
    end
    let(:wrong_params) { { email: 'notanemail', password: '', first_name: '', last_name: '' } }
  end
end