Convert age verification controller to system specs (#36026)
This commit is contained in:
@@ -110,9 +110,12 @@ RSpec.describe '/api/v1/accounts' do
|
||||
let(:date_of_birth) { 13.years.ago.strftime('%d.%m.%Y') }
|
||||
|
||||
it 'returns http unprocessable entity' do
|
||||
subject
|
||||
expect { subject }
|
||||
.to not_change(User, :count)
|
||||
.and not_change(Account, :count)
|
||||
|
||||
expect(response).to have_http_status(422)
|
||||
expect(response)
|
||||
.to have_http_status(422)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
@@ -122,9 +125,27 @@ RSpec.describe '/api/v1/accounts' do
|
||||
let(:date_of_birth) { 17.years.ago.strftime('%d.%m.%Y') }
|
||||
|
||||
it 'creates a user', :aggregate_failures do
|
||||
subject
|
||||
expect { subject }
|
||||
.to change(User, :count).by(1)
|
||||
.and change(Account, :count).by(1)
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when date of birth is over age limit in ISO-8601 format' do
|
||||
let(:date_of_birth) { 17.years.ago.to_date.iso8601 }
|
||||
|
||||
it 'creates a user', :aggregate_failures do
|
||||
expect { subject }
|
||||
.to change(User, :count).by(1)
|
||||
.and change(Account, :count).by(1)
|
||||
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user