CSC/ECE 517 Fall 2016/E1644. Refactor and test Teams Controller
E1644. Refactor and Test 'Teams_Controller' Controller<ref>Project Description document https://google.com</ref>
This page provides a brief description of the Expertiza project. The project is aimed at refactoring and testing the 'Teams_Controller' Controller, which contains the methods to create new teams, list the existing teams, create new teams by inheriting existing teams, deleting existing teams and creating multiple teams at once by assigning them random topics. The project entailed, refactoring some part of the controller to improve the readability of code and then creating test cases in RSpec to verify the methods it possesses.
Introduction to Expertiza
Expertiza is a peer review based system which provides incremental learning from the class. This project has been developed together by faculty and students using Ruby on Rails framework. Expertiza allows the instructor to create, edit and delete assignments, create new assignment topics, assign them to a particular class or selected students, have students work on teams and then review each other's assignments at the end. For the students, they can signup for topics, form teams, and submit their projects and assignments. Students then review the work done by other students and give suggestions to improve. Teams after reviews are allotted scores and they can refer to the peer comments to further improve their work. It also supports submission of different file types for assignments, including the URLs and wiki pages.
Why refactoring?
Refactoring<ref>Refactoring https://en.wikipedia.org/wiki/Code_refactoring</ref> is restructuring of code without the need of changing any external behavior. It reduces complexity and improves readability. It also becomes easy to extend the application with respect to different modules and their functionalities. Some common techniques to refactor are:
- Moving methods to appropriate modules
- Breaking methods into more meaningful functionality
- Creating more generalized code.
- Renaming methods and variable.
- Inheritance
Project Description
Teams_Controller primarily handles the team creation, deletion and other behaviours. Most of those are called from the instructor’s view. When manual testing is done, most of the methods can be called by clicking the “Create teams” icon from both assignments and courses. The following tasks have been performed as per the requirements.
As a part of the project, some GUI's changes had to be made because they did not work the way they should have, some minor issues in the code were fixed and tests were written in RSpec for the methods delete, create, create teams, list and inherit.
Create Method
The method Create is called when an instructor tries to create a team manually. This works for both creating assignment teams and course teams. Assignment teams are teams made to do a particular assignment together and Course Teams are teams which are made for the whole course.
- Refactor variable -> @signUps to snake case.
- Writing tests for Create method.
- Writing tests for Delete method.
- Writing tests for List method.
- Writing tests for Inherit method