Add subject to test

Added subject to test because it seems that without
a re-declaration of subject, the response will be nil

As of now, the response is 422. Not sure why.
This commit is contained in:
Leni Kadali 2024-09-26 18:05:47 +03:00
parent 9fc4ed4027
commit d36c2f27f3

View File

@ -164,10 +164,16 @@ RSpec.describe '/api/v1/accounts' do
end
context 'when user tries to follow their own account' do
subject do
post "/api/v1/accounts/#{other_account.id}/follow", headers: headers
end
let(:locked) { false }
let(:other_account) { user.account }
it 'returns http forbidden and error message' do
subject
error_msg = 'Following your own account is not allowed'
expect(response).to have_http_status(403)