[openstreetmap/openstreetmap-website] Final controller test refactorings (#2626)
Andy Allan
notifications at github.com
Wed May 13 16:22:17 UTC 2020
This refactors api/traces_controller_test and user_controller_test. The latter was a bit tough, since a lot of the tests involved somewhat artificial setup involving direct access to the session. In many cases around the testing of the terms and confirmation pages, the approach I've taken is to work through the first half of the signup process, to get the session into the expected state.
I found a bunch of tests were misnamed, since they were called 'test_new_something' but were testing the save method. Some things like duplicate emails are tested both during the submission of the signup form, and again during the creation of the user record in the save method. So I've renamed the tests and kept them testing the second stage, since it's more important. I added one test for the first step just for belts and braces.
You can view, comment on, or merge this pull request online at:
https://github.com/openstreetmap/openstreetmap-website/pull/2626
-- Commit Summary --
* Refactor api traces_controller tests
* Refactor user controller tests
* Remove unused test helper
-- File Changes --
M config/routes.rb (8)
M test/controllers/api/traces_controller_test.rb (128)
M test/controllers/users_controller_test.rb (548)
M test/test_helper.rb (6)
-- Patch Links --
https://github.com/openstreetmap/openstreetmap-website/pull/2626.patch
https://github.com/openstreetmap/openstreetmap-website/pull/2626.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/2626
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20200513/f198f3bd/attachment.htm>
More information about the rails-dev
mailing list