File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed
Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -9,11 +9,16 @@ def new
99 end
1010
1111 def create
12- if identity = Identity . find_by_email_address ( email_address )
13- magic_link = identity . send_magic_link
14- serve_development_magic_link ( magic_link )
12+ identity = Identity . find_by_email_address ( email_address )
13+
14+ magic_link = if identity
15+ identity . send_magic_link
16+ else
17+ Signup . new ( email_address : email_address ) . create_identity
1518 end
1619
20+ serve_development_magic_link ( magic_link )
21+
1722 redirect_to session_magic_link_path
1823 end
1924
Original file line number Diff line number Diff line change @@ -24,12 +24,15 @@ class SessionsControllerTest < ActionDispatch::IntegrationTest
2424
2525 test "create for a new user" do
2626 untenanted do
27- assert_no_difference -> { MagicLink . count } do
28- post session_path ,
29- params : { email_address : "nonexistent-#{ SecureRandom . hex ( 6 ) } @example.com" }
27+ assert_difference -> { MagicLink . count } , +1 do
28+ assert_difference -> { Identity . count } , +1 do
29+ post session_path ,
30+ params : { email_address : "nonexistent-#{ SecureRandom . hex ( 6 ) } @example.com" }
31+ end
3032 end
3133
3234 assert_redirected_to session_magic_link_path
35+ assert MagicLink . last . for_sign_up?
3336 end
3437 end
3538
You can’t perform that action at this time.
0 commit comments