DEV: Add test (#10066)

DEV: Add test (#10066)

Follow-up-to f1b97202d445279e8a64a81fddb5678e636f5114

diff --git a/spec/requests/users_email_controller_spec.rb b/spec/requests/users_email_controller_spec.rb
index 92cd157..06cc9ce 100644
--- a/spec/requests/users_email_controller_spec.rb
+++ b/spec/requests/users_email_controller_spec.rb
@@ -49,6 +49,17 @@ describe UsersEmailController do
         updater.change_to('new.n.cool@example.com')
       end
 
+      it 'includes security_key_allowed_credential_ids in a hidden field' do
+        key1 = Fabricate(:user_security_key_with_random_credential, user: user)
+        key2 = Fabricate(:user_security_key_with_random_credential, user: user)
+
+        get "/u/confirm-new-email/#{user.email_tokens.last.token}"
+
+        doc = Nokogiri::HTML5(response.body)
+        credential_ids = doc.css("#security-key-allowed-credential-ids").first["value"].split(",")
+        expect(credential_ids).to contain_exactly(key1.credential_id, key2.credential_id)
+      end
+
       it 'confirms with a correct token' do
         user.user_stat.update_columns(bounce_score: 42, reset_bounce_score_after: 1.week.from_now)
 

GitHub sha: 79ab1493

This commit appears in #10066 which was merged by udan11.