Check response body instead of assigns in settings 2fa confirmations controller spec

This commit is contained in:
Matt Jankowski 2024-04-30 12:23:54 -04:00
parent f741c1308c
commit f18341bd89
1 changed files with 8 additions and 3 deletions

View File

@ -9,11 +9,16 @@ describe Settings::TwoFactorAuthentication::ConfirmationsController do
it 'renders the new view' do
subject
expect(assigns(:confirmation)).to be_instance_of Form::TwoFactorConfirmation
expect(assigns(:provision_url)).to eq 'otpauth://totp/cb6e6126.ngrok.io:local-part%40domain?secret=thisisasecretforthespecofnewview&issuer=cb6e6126.ngrok.io'
expect(assigns(:qrcode)).to be_instance_of RQRCode::QRCode
expect(response).to have_http_status(200)
expect(response).to render_template(:new)
expect(response.body)
.to include(qr_code_markup)
end
def qr_code_markup
RQRCode::QRCode.new(
'otpauth://totp/cb6e6126.ngrok.io:local-part%40domain?secret=thisisasecretforthespecofnewview&issuer=cb6e6126.ngrok.io'
).as_svg(padding: 0, module_size: 4)
end
end