-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add integration test for signup functionality #99
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review the suggestion below
One doubt i have is that currently there is not much feature for signup to write tests. Hence can we rename the signup
directory to auth
and place this file inside it as auth/signup.spec.rb
. Later we will add more signin test in it.
Other looks good to me.
visit new_user_registration_path | ||
expect(page).to have_content('Sign up new account') | ||
|
||
fill_in('user_full_name', with: 'John Doe') | ||
select "ASHA", :from => "user_role" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These lines are repeating in every test iteration. Can we use before(:each)
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. Will do that.
expect(page).to have_content('Your account is not verified!') | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation seems too much.
Does prettier support ruby file 🤔
Otherwise we have to install rufo extension 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@peeyush14goyal What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prettier now supports Ruby formatting as well. Is your prettier working @divyagar ?
fill_in('user_email', with: '[email protected]') | ||
fill_in('user_phone', with: '9988776677') | ||
fill_in('user_password', with: 'JohnDoe') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can fill these info using Faker
for generating names, emails etc. Its like chance.js and we can avoid these hardcoded data.
Faker
creates different names, emails etc i think. everytime it runs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. Will use that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@abhinandanarya06 We also need to store the names and password as well as we need the same for Login as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then I think we have create user
command in factorybot. We can use it in Login testing.
Or we can use rspec fixtures if we need to store and reuse in different tests.
I have added integration tests for signup feature.
https://www.loom.com/share/77893a2edfa645c9b64f74c6fa552cb2