fuseumass / dashboard

Dashboard makes it easy to manage a hackathon.
https://platform.hackumass.com
Apache License 2.0
43 stars 23 forks source link

Write Testcases for the whole Codebase #235

Open abhinavtripathy opened 4 years ago

abhinavtripathy commented 4 years ago

Writing tests would improve our codebase as whole and we will lead to lesser bugs.

harsh183 commented 4 years ago

Sure, start with model unit testing.

harsh183 commented 4 years ago

Probably open up a few more issues something more specific like 'Write test for X Model' or 'Improve Integrate Test for Hardware Loan'?

harsh183 commented 4 years ago

Check out shoulda-matchers it will considerably help you with writing the simple test cases quick.

https://guides.railsgirls.com/testing-shoulda-matchers

https://github.com/thoughtbot/shoulda-matchers

Once you've written test cases you can integrate it into your CI very smoothly and refactor your code far more confidently.

harsh183 commented 4 years ago

Since you asked for a few examples take a look at this gist. I do suggest setting up capybara for integration testing as well (and my gist has a few links to good tutorials)