CSC/ECE 517 Fall 2021 - E2126. Refactor account request controller.rb

From Expertiza_Wiki
Revision as of 23:05, 19 October 2021 by Cpsmith6 (talk | contribs)
Jump to navigation Jump to search

About Expertiza

Expertiza is an open source project based on Ruby on Rails framework that supports submission across different document types, including theURLs and wiki pages. It allows the instructor not only to create and customize new or existing assignments but also 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.


Description about project

This page is a description of Expertiza OSS project E2126 which refactoring the account_request_controller.rb file. This file allows Super Administrators to manage the approval process for new users. Our job was to refactor some of the longer methods in this file, make error messages more intuitive, and add a security captcha to the approval/rejection process.

Team

Connor Smith (cpsmith6)

Abir Majumder (aamajumd)

Joshua Myers (jamyers3)

Files Involved

account_request_controller.rb

Running Tests

  rspec ./spec/controllers/account_request_controller.rb

Relevant Methods

  • action_allowed?
  • create_approved_user
  • create_requested_user_record

action_allowed?

This method returns the correct html tag if a review file exist. Otherwise, it should return an empty string when the file does not exist. In the first test, a sudo file created in AssignmentTeam is allowed to find and return a correct html that start with "<a href". In the second test, since the file does not exist, it returns an empty string.

    it 'should return correct html a tag' do
      result = helper.list_review_submissions(@participant.id, @team.id, @response_map.id)
      expect(result).to start_with("<a href")
    end
    it 'should return an empty string when the file does not exist' do
      result = helper.list_review_submissions(@participant.id, @team.id, @response_map.id)
    expect(result).to eq('')

list_hyperlink_submission

This method returns the hyperlink that the student submits. In this unit test, since the student does not submit a hyperlink, which means the comment does not exist, an empty string is expected to return.

    it 'should return an empty string when comment does not exist' do
      result = helper.list_hyperlink_submission(@response_map.id, @question.id)
      expect(result).to eq('')
    end 

Results

34 out of 34 tests in the review_mapping_helper_spec.rb test file.

Our code changes can be viewed here.

URL link of video of review_mapping_helper_spec.rb tests running and passing:- https://drive.google.com/file/d/1OS4yNI0fDGo4TlkOSxuWNgfMZ4D-XU2f/view

Relevant Links

Main Expertiza Repository can be found here.

Our forked Repository can be found here.