Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

divyagar
Copy link
Contributor

I have added integration tests for signup feature.

https://www.loom.com/share/77893a2edfa645c9b64f74c6fa552cb2

@divyagar divyagar requested review from peeyush14goyal and a user September 16, 2021 10:44
Copy link

@ghost ghost left a 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.

Comment on lines +5 to +9
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"
Copy link

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. Will do that.

Comment on lines +17 to +19
expect(page).to have_content('Your account is not verified!')
end

Copy link

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 😅

Copy link
Contributor Author

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?

Copy link
Contributor

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 ?

Comment on lines +10 to +12
fill_in('user_email', with: '[email protected]')
fill_in('user_phone', with: '9988776677')
fill_in('user_password', with: 'JohnDoe')
Copy link

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. Will use that.

Copy link
Contributor

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

Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants