Check response body instead of assigns in account controller concern spec

This commit is contained in:
Matt Jankowski 2024-04-30 11:49:18 -04:00
parent c47f3415a5
commit a8886648f3
1 changed files with 4 additions and 3 deletions

View File

@ -7,7 +7,7 @@ describe AccountControllerConcern do
include AccountControllerConcern
def success
head 200
render plain: @account.username # rubocop:disable RSpec/InstanceVariable
end
end
@ -51,12 +51,13 @@ describe AccountControllerConcern do
context 'when account is not suspended' do
let(:account) { Fabricate(:account, username: 'username') }
it 'assigns @account, returns success, and sets link headers' do
it 'Prepares the account, returns success, and sets link headers' do
get 'success', params: { account_username: account.username }
expect(assigns(:account)).to eq account
expect(response).to have_http_status(200)
expect(response.headers['Link'].to_s).to eq(expected_link_headers)
expect(response.body)
.to include(account.username)
end
def expected_link_headers