[openstreetmap/openstreetmap-website] Initial user_factory refactoring (#1423)
Andy Allan
notifications at github.com
Thu Feb 2 15:24:07 UTC 2017
This pull request starts the process of replacing the users.yml fixtures with a user factory. Given the size of the change by the end of the process, I plan to submit several individual pull requests.
This PR creates the user and user_role factories, and refactors only the test/models/user_test.rb file.
Given the number of tests involved even just with this one file, I've broken it down further into separate commits, so the `git blame` etc can have specific comments. If this PR is still too big, or something is controversial, I'm happy to split this PR into the ~11 separate PRs - but then each PR is a bit trivial.
Future work will involve refactoring other places where the user fixtures are used.
You can view, comment on, or merge this pull request online at:
https://github.com/openstreetmap/openstreetmap-website/pull/1423
-- Commit Summary --
* Create a simple user factory, and convert some basic tests.
* Add with_home_location trait for user factories.
* Add a user_role factory
* Add moderator_user and administrator_user factories.
* Add status traits to user factory.
* Convert class method tests to use User factory.
* User factory for uniqueness tests
* Convert test_friend_with to use factories, and use alice/bob/charlie for easier understanding.
* Refactor the friend_users test, and remove the tests which duplicate the (renamed) test_friends_with above.
* Use factory for user language tests
* Convert the test_users_nearby to user factories.
-- File Changes --
M app/models/user_role.rb (1)
A test/factories/user.rb (44)
A test/factories/user_role.rb (6)
M test/models/user_test.rb (171)
-- Patch Links --
https://github.com/openstreetmap/openstreetmap-website/pull/1423.patch
https://github.com/openstreetmap/openstreetmap-website/pull/1423.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/1423
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20170202/8344bd39/attachment.html>
More information about the rails-dev
mailing list