1313 allow ( helper ) . to receive_messages ( resource : user , session : { } )
1414 end
1515
16- def parsed ( html )
16+ def parse ( html )
1717 Capybara . string ( html )
1818 end
1919
@@ -30,7 +30,7 @@ def have_hidden_credential_field
3030 form . submit "Create Passkey"
3131 end
3232
33- page = parsed ( html )
33+ page = parse ( html )
3434 expect ( page ) . to have_css ( "form" )
3535 expect ( page ) . to have_css ( "webauthn-create[data-options-url='/accounts/passkey_registration_options']" )
3636 expect ( page ) . to have_hidden_credential_field
@@ -42,7 +42,7 @@ def have_hidden_credential_field
4242 form . submit "Create"
4343 end
4444
45- expect ( parsed ( html ) ) . to have_css ( "form.custom-form" )
45+ expect ( parse ( html ) ) . to have_css ( "form.custom-form" )
4646 end
4747 end
4848
@@ -52,7 +52,7 @@ def have_hidden_credential_field
5252 form . submit "Log in with passkeys"
5353 end
5454
55- page = parsed ( html )
55+ page = parse ( html )
5656 expect ( page ) . to have_css ( "form[action='/accounts/sign_in']" )
5757 expect ( page ) . to have_css ( "webauthn-get[data-options-url='/accounts/passkey_authentication_options']" )
5858 expect ( page ) . to have_hidden_credential_field
@@ -64,7 +64,7 @@ def have_hidden_credential_field
6464 form . submit "Login"
6565 end
6666
67- expect ( parsed ( html ) ) . to have_css ( "form.passkey-form" )
67+ expect ( parse ( html ) ) . to have_css ( "form.passkey-form" )
6868 end
6969
7070 it "allows custom content in the block" do
@@ -74,7 +74,7 @@ def have_hidden_credential_field
7474 end
7575 end
7676
77- page = parsed ( html )
77+ page = parse ( html )
7878 expect ( page ) . to have_css ( "div.button-wrapper" )
7979 expect ( page ) . to have_css ( "input.btn-primary[type='submit']" )
8080 end
@@ -86,7 +86,7 @@ def have_hidden_credential_field
8686 form . submit "Add Security Key"
8787 end
8888
89- page = parsed ( html )
89+ page = parse ( html )
9090 expect ( page ) . to have_css ( "form" )
9191 expect ( page ) . to have_css ( "webauthn-create[data-options-url='/accounts/security_key_registration_options']" )
9292 expect ( page ) . to have_hidden_credential_field
@@ -98,7 +98,7 @@ def have_hidden_credential_field
9898 form . submit "Add"
9999 end
100100
101- expect ( parsed ( html ) ) . to have_css ( "form.security-key-form" )
101+ expect ( parse ( html ) ) . to have_css ( "form.security-key-form" )
102102 end
103103 end
104104
@@ -108,7 +108,7 @@ def have_hidden_credential_field
108108 form . submit "Use security key"
109109 end
110110
111- page = parsed ( html )
111+ page = parse ( html )
112112 expect ( page ) . to have_css ( "form" )
113113 expect ( page ) . to have_css ( "webauthn-get[data-options-url='/accounts/security_key_authentication_options']" )
114114 expect ( page ) . to have_hidden_credential_field
@@ -120,15 +120,15 @@ def have_hidden_credential_field
120120 form . submit "Verify"
121121 end
122122
123- expect ( parsed ( html ) ) . to have_css ( "form.two-factor-form" )
123+ expect ( parse ( html ) ) . to have_css ( "form.two-factor-form" )
124124 end
125125
126126 it "allows custom content in the block" do
127127 html = helper . login_with_security_key_form_for ( resource : user ) do |form |
128128 helper . safe_join ( [ helper . content_tag ( :p , "Authenticate with your security key" ) , form . submit ( "Authenticate" ) ] )
129129 end
130130
131- page = parsed ( html )
131+ page = parse ( html )
132132 expect ( page ) . to have_css ( "p" , text : "Authenticate with your security key" )
133133 expect ( page ) . to have_button ( "Authenticate" )
134134 end
0 commit comments