DEV Community

Discussion on: dev.to open source help/discussion thread (v0)

Collapse
 
delbetu profile image
M Bellucci • Edited

Hello everyone!
I'm trying to write specs for login/signup procedure.
I've inspected the code and came out with these potential scenarios.
Can someone help me to correct, validate, refine these scenarios to met the reality?
(I follow the format ---> )

1 User never login before

create new user
create new identity
update user data
create session
go to welcome page

2 User second login with same provider

find existing user
find existing identity
update user data
create session
go to dashboard

3 User second login with other provider

find existing user
create new identity
update user data
create session
go to dashboard

4 User revoked authorization on twitter, login and re-authorizes

find existing user
find existing identity
update user data
create session
go to dashboard
Error cases ——

5 Twitter doesn’t provide enough information for the user (let’s say uid is nil)

don't create session
go to back to same page
display error message Twitter authorization problem. Try again later

Collapse
 
delbetu profile image
M Bellucci

@ben ^ ?

Collapse
 
ben profile image
Ben Halpern

That seems like the right path. @andy can provide more thoughts

Collapse
 
andy profile image
Andy Zhao (he/him)

Yep, that sounds right. We have a feature test for Twitter auth /spec/features/user_logs_in_with_twitter_spec.rb and some other tests for registration in spec/models/user_spec.rb#270. Those should be helpful for see what else would need coverage.

Collapse
 
delbetu profile image
M Bellucci

Awesome thanks I'll take a look.