OSS Project: Users Controller Refactoring in Expertiza
This project is related to make contributions to an open-source project named Expertiza. I refactored the existing bad smells following
Ruby on Rails
best practises, implemented new features related to user model and writingRSpec
tests with two team members.
Description
- Find the un-called methods if any and delete them.
- Change the Rails 2 syntax to
Rails 4
style. - Refactor
users_controller.rb
- Change the white space for the second half of this file, starts at “def edit”.
- Separate the
paginate_list
method into two methods. The search method should be in model and the paginating method should be in the controller. New feature
: delete users- A user can be deleted if (s)he has not participated in an assignment.
- If the user is participating in an assignment, the system will ask, “User is participating in k assignments. Delete as a participant in these assignment(s)?”
- If the user has submitted or reviewed in any of these assignments, the system will say the user cannot be deleted, but offer to rename the user account to
_hidden. - rename (javascript calling update method in users_controller.rb)
- different users have different delete methods.
- If the person trying to delete does not want to rename the account, the system will just say that the user can’t be deleted.
- Write
Rspec
unit test and increase the test coverage to28
%.
Related Material
- Source code
- Wiki page
- Demo video
/end