CSC/ECE 517 Fall 2021 - E2122. Refactor impersonate controller.rb

From Expertiza_Wiki
Jump to navigation Jump to search

This wiki page describes the changes made under E2122, in order to refactor impersonate_controller.rb.

Overview

About Expertiza

Expertiza is an open source project based on Ruby on Rails framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.

Issues for this project

  • Issue 1: Throughout the file, the user is being initialized but never used. This is bad coding practice as it slows down runtime.
  • Issue 2: Convert nested if to elif around line 36.
  • Issue 3: Refactor very long lines of code to make it more readable.
  • Issue 4: Test functions and increase coverage:
    • auto_complete_for_user_name
    • overwrite_session test line 47-51
    • test_

Project implementation

Submitted work and demonstration of project

Files involved

  • app/controllers/impersonate_controller.rb
  • spec/controllers/impersonate_controller_spec.rb

Code changes

  • Controller

app/controllers/impersonate_controller.rb

def quick_sort(arr):
	less = []
	pivot_list = []
	more = []
	if len(arr) <= 1:
		return arr
	else:
		pass
  • Tests

Test Plan

Manual UI Testing

The following steps must be performed to test the project UI:

Step 1: Log in as an Instructor, with Username - instructor6, Password - password




Step 2: TODO

RSpec Testing

Team Information

Mentor: John Bumgardner (jwbumga2)


Robin Piao (lpiao)

Shengjie Guo (sguo25)

Haoze Du (hdu5)