diff --git a/spec/requests/api/v1/accounts_spec.rb b/spec/requests/api/v1/accounts_spec.rb index 94a790b4cd0..0e64915baf3 100644 --- a/spec/requests/api/v1/accounts_spec.rb +++ b/spec/requests/api/v1/accounts_spec.rb @@ -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,12 @@ 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 @@ -134,7 +140,9 @@ RSpec.describe '/api/v1/accounts' do let(:date_of_birth) { 17.years.ago.to_date.iso8601 } 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)