CSC/ECE 517 Fall 2021 - E2132. Add tests cases for review mapping helper.rb: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 464: Line 464:
== Results ==
== Results ==


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


==
Our code changes can be viewed [https://github.com/expertiza/expertiza/pull/1763/files 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 [https://github.com/expertiza/expertiza here].
 
Our forked Repository can be found [https://github.com/ctripoll/expertiza/tree/beta here].

Revision as of 08:26, 16 October 2021

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 E2132 which is adding unit tests for review_mapping_helper.rb. The ReviewMappingHelper works as a class that is responsible for mapping reviews and feedback to assignment teams and reviewers. Also, This helper class reports of the status of project reviews.

Team

Chen-Ni Liu (cliu43)

Shao-Yo Chao (schao2)

Fu-Jen Yen (fyen)

Files Involved

review_mapping_helper.rb

review_mapping_helper_spec.rb

Running Tests

  rspec spec/helpers/review_mapping_helper_spec.rb

Relevant Methods

  • response_for_each_round?
  • submitted_within_round?
  • submitted_hyperlink
  • get_team_reviewed_link_name
  • sort_reviewer_by_review_volume_desc
  • list_review_submission
  • list_hyperlink_submission
  • get_certain_review_and_feedback_response_map
  • get_css_style_for_calibration_report

response_for_each_round?

This method returns in boolean function if the assignments are submitted on time. It is expected to return true only if every assignment is submitted on time. For the first part of unit test, one response is needed for a true result in one round. As for the second part, both responses are needed for a true result in two rounds. If any response is missing, it should return false.

    it 'should return false if response wasnt submitted in every round' do
      create(:assignment_due_date, assignment: @assignment, parent_id: @assignment.id, round: 1)
      create(:assignment_due_date, assignment: @assignment, parent_id: @assignment.id, round: 2)

      create(:response, response_map: @response_map)
      check_response = response_for_each_round?(@response_map)
      expect(check_response).to eq(false)
    end

    #one round, one response
    it 'should return true if there is one response with one round' do
      create(:deadline_right, name: 'No')
      create(:deadline_right, name: 'Late')
      create(:deadline_right, name: 'OK')

      # make a team for the assignment
      create(:assignment_team, assignment: @assignment)

      response_map_with_reviewee = create(:review_response_map, reviewer: @reviewer, reviewee: @reviewee)
      create(:submission_record, assignment_id: @assignment.id, team_id: @reviewee.id, operation: 'Submit Hyperlink', content: 'random link', created_at: DateTime.now.in_time_zone - 7.day)
      create(:assignment_due_date, assignment: @assignment, parent_id: @assignment.id, round: 1, due_at: DateTime.now.in_time_zone - 5.day)
      create(:response, response_map: response_map_with_reviewee)

      check_response = response_for_each_round?(response_map_with_reviewee)
      expect(check_response).to eq(true)
    end

    #two round,two response
    it 'should return true if there were both response' do
      create(:deadline_right, name: 'No')
      create(:deadline_right, name: 'Late')
      create(:deadline_right, name: 'OK')

      # make a team for the assignment
      create(:assignment_team, assignment: @assignment)

      response_map_with_reviewee = create(:review_response_map, reviewer: @reviewer, reviewee: @reviewee)
      create(:submission_record, assignment_id: @assignment.id, team_id: @reviewee.id, operation: 'Submit Hyperlink', content: 'random link', created_at: DateTime.now.in_time_zone - 7.day)
      create(:submission_record, assignment_id: @assignment.id, team_id: @reviewee.id, operation: 'Submit Hyperlink', content: 'random link', created_at: DateTime.now.in_time_zone - 3.day)

      create(:assignment_due_date, assignment: @assignment, parent_id: @assignment.id, round: 1, due_at: DateTime.now.in_time_zone - 5.day)
      create(:assignment_due_date, assignment: @assignment, parent_id: @assignment.id, round: 2, due_at: DateTime.now.in_time_zone - 2.day)
      create(:response, response_map: response_map_with_reviewee, round: 1)
      create(:response, response_map: response_map_with_reviewee, round: 2)

      check_response = response_for_each_round?(response_map_with_reviewee)
      expect(check_response).to eq(true)
    end

    #two round, only have first response
    it 'should return false if only have first response' do
      create(:deadline_right, name: 'No')
      create(:deadline_right, name: 'Late')
      create(:deadline_right, name: 'OK')

      # make a team for the assignment
      create(:assignment_team, assignment: @assignment)

      response_map_with_reviewee = create(:review_response_map, reviewer: @reviewer, reviewee: @reviewee)
      create(:submission_record, assignment_id: @assignment.id, team_id: @reviewee.id, operation: 'Submit Hyperlink', content: 'random link', created_at: DateTime.now.in_time_zone - 2.day)
      create(:submission_record, assignment_id: @assignment.id, team_id: @reviewee.id, operation: 'Submit Hyperlink', content: 'random link', created_at: DateTime.now.in_time_zone - 3.day)

      create(:assignment_due_date, assignment: @assignment, parent_id: @assignment.id, round: 1, due_at: DateTime.now.in_time_zone - 5.day)
      create(:assignment_due_date, assignment: @assignment, parent_id: @assignment.id, round: 2, due_at: DateTime.now.in_time_zone + 6.day)
      create(:response, response_map: response_map_with_reviewee, round: 1)

      check_response = response_for_each_round?(response_map_with_reviewee)
      expect(check_response).to eq(false)
    end

    #two round,only have second response
    it 'should return false if only have second response' do
      create(:deadline_right, name: 'No')
      create(:deadline_right, name: 'Late')
      create(:deadline_right, name: 'OK')

      # make a team for the assignment
      create(:assignment_team, assignment: @assignment)

      response_map_with_reviewee = create(:review_response_map, reviewer: @reviewer, reviewee: @reviewee)
      create(:submission_record, assignment_id: @assignment.id, team_id: @reviewee.id, operation: 'Submit Hyperlink', content: 'random link', created_at: DateTime.now.in_time_zone - 7.day)
      create(:submission_record, assignment_id: @assignment.id, team_id: @reviewee.id, operation: 'Submit Hyperlink', content: 'random link', created_at: DateTime.now.in_time_zone - 1.day)

      create(:assignment_due_date, assignment: @assignment, parent_id: @assignment.id, round: 1, due_at: DateTime.now.in_time_zone - 5.day)
      create(:assignment_due_date, assignment: @assignment, parent_id: @assignment.id, round: 2, due_at: DateTime.now.in_time_zone - 2.day)
      create(:response, response_map: response_map_with_reviewee, round: 2)

      check_response = response_for_each_round?(response_map_with_reviewee)
      expect(check_response).to eq(false)
    end

submitted_within_round?

This method checks the record if the assignment is submitted on time, that is, before due date. In the unit test, two submissions on two different due date are set up, and therefore would be four situations to discuss. In the first situation, all the works are submitted on time, the response is expected to be true. In the second situation, both of the works are delayed, so the response definitely returns false. If either one of the submission is delayed, the response depends on the last submission's status. That is, if the last submission is on time, the response is true. On the other hand, if the last submission is delayed, the response is false even thought the former submission is on time.


    it 'should return true if works were submitted within 2 round' do
      create(:deadline_right, name: 'No')
      create(:deadline_right, name: 'Late')
      create(:deadline_right, name: 'OK')
      create(:submission_record, assignment_id: @assignment.id, team_id: @reviewee.id, operation: 'Submit Hyperlink', content: 'https://wiki.archlinux.org/', created_at: DateTime.now.in_time_zone - 7.day)
      create(:submission_record, assignment_id: @assignment.id, team_id: @reviewee.id, operation: 'Submit Hyperlink', content: 'https://wiki.archlinux.org/', created_at: DateTime.now.in_time_zone - 1.day)
      create(:response, response_map: @response_map)
      create(:assignment_due_date, assignment: @assignment, parent_id: @assignment.id, round: 1, due_at: DateTime.now.in_time_zone - 5.day)
      create(:assignment_due_date, assignment: @assignment, parent_id: @assignment.id, round: 2, due_at: DateTime.now.in_time_zone + 6.day)

      assignment_created = @assignment.created_at
      assignment_due_dates = DueDate.where(parent_id: @response_map.reviewed_object_id)

      check_submitetd = submitted_within_round?(@round, @response_map, assignment_created, assignment_due_dates)
      expect(check_submitetd).to eq(true)
    end

    #for two round, both of the submissions are late
    it 'should return false if both works was submitted late' do
      create(:deadline_right, name: 'No')
      create(:deadline_right, name: 'Late')
      create(:deadline_right, name: 'OK')
      create(:submission_record, assignment_id: @assignment.id, team_id: @reviewee.id, operation: 'Submit Hyperlink', content: 'https://wiki.archlinux.org/', created_at: DateTime.now.in_time_zone - 4.day)
      create(:submission_record, assignment_id: @assignment.id, team_id: @reviewee.id, operation: 'Submit Hyperlink', content: 'https://wiki.archlinux.org/', created_at: DateTime.now.in_time_zone - 3.day)
      create(:response, response_map: @response_map)
      create(:assignment_due_date, assignment: @assignment, parent_id: @assignment.id, round: 1, due_at: DateTime.now.in_time_zone - 10.day)
      create(:assignment_due_date, assignment: @assignment, parent_id: @assignment.id, round: 2, due_at: DateTime.now.in_time_zone - 5.day)

      assignment_created = @assignment.created_at
      assignment_due_dates = DueDate.where(parent_id: @response_map.reviewed_object_id)

      check_submitetd = submitted_within_round?(@round, @response_map, assignment_created, assignment_due_dates)
      expect(check_submitetd).to eq(false)
    end

    # for two round, only the second submission is on time
    # We spent some time to figure out the logic in this function,
    # but now we believe whether an assignment is late depends on the last due date.
    # So, assignment will view as on time if user submitted before the last deadline.
    it 'should return true if first work was submitted late' do
      create(:deadline_right, name: 'No')
      create(:deadline_right, name: 'Late')
      create(:deadline_right, name: 'OK')
      create(:submission_record, assignment_id: @assignment.id, team_id: @reviewee.id, operation: 'Submit Hyperlink', content: 'https://wiki.archlinux.org/', created_at: DateTime.now.in_time_zone - 7.day)
      create(:submission_record, assignment_id: @assignment.id, team_id: @reviewee.id, operation: 'Submit Hyperlink', content: 'https://wiki.archlinux.org/', created_at: DateTime.now.in_time_zone - 6.day)
      create(:response, response_map: @response_map)
      create(:assignment_due_date, assignment: @assignment, parent_id: @assignment.id, round: 1, due_at: DateTime.now.in_time_zone - 10.day)
      create(:assignment_due_date, assignment: @assignment, parent_id: @assignment.id, round: 2, due_at: DateTime.now.in_time_zone - 5.day)

      assignment_created = @assignment.created_at
      assignment_due_dates = DueDate.where(parent_id: @response_map.reviewed_object_id)

      check_submitetd = submitted_within_round?(@round, @response_map, assignment_created, assignment_due_dates)
      expect(check_submitetd).to eq(true)
    end

    # for two round, only the first submission is on time
    # If you miss the last submission, than it will return false
    it 'should return false if second work was submitted late' do
      create(:deadline_right, name: 'No')
      create(:deadline_right, name: 'Late')
      create(:deadline_right, name: 'OK')
      create(:submission_record, assignment_id: @assignment.id, team_id: @reviewee.id, operation: 'Submit Hyperlink', content: 'https://wiki.archlinux.org/', created_at: DateTime.now.in_time_zone - 11.day)
      create(:submission_record, assignment_id: @assignment.id, team_id: @reviewee.id, operation: 'Submit Hyperlink', content: 'https://wiki.archlinux.org/', created_at: DateTime.now.in_time_zone - 2.day)
      create(:response, response_map: @response_map)
      create(:assignment_due_date, assignment: @assignment, parent_id: @assignment.id, round: 1, due_at: DateTime.now.in_time_zone - 10.day)
      create(:assignment_due_date, assignment: @assignment, parent_id: @assignment.id, round: 2, due_at: DateTime.now.in_time_zone - 5.day)

      assignment_created = @assignment.created_at
      assignment_due_dates = DueDate.where(parent_id: @response_map.reviewed_object_id)

      check_submitetd = submitted_within_round?(@round, @response_map, assignment_created, assignment_due_dates)
      expect(check_submitetd).to eq(false)
    end

submitted_hyperlink

This method returns the hyperlink that is submitted on time. For one assignment, it returns the hyperlink that is submitted before due date. For multiple assignments, no matter how many assignments are submitted on time, it shows the hyperlink of the last submission that is submitted on time.

    it 'should return https://wiki.archlinux.org/123 if works was submitted on time' do
      create(:deadline_right, name: 'No')
      create(:deadline_right, name: 'Late')
      create(:deadline_right, name: 'OK')
      create(:submission_record, assignment_id: @assignment.id, team_id: @reviewee.id, operation: 'Submit Hyperlink', content: 'https://wiki.archlinux.org/', created_at: DateTime.now.in_time_zone - 12.day)
      create(:submission_record, assignment_id: @assignment.id, team_id: @reviewee.id, operation: 'Submit Hyperlink', content: 'https://wiki.archlinux.org/123', created_at: DateTime.now.in_time_zone - 7.day)
      create(:response, response_map: @response_map)
      create(:assignment_due_date, assignment: @assignment, parent_id: @assignment.id, round: 1, due_at: DateTime.now.in_time_zone - 10.day)
      create(:assignment_due_date, assignment: @assignment, parent_id: @assignment.id, round: 2, due_at: DateTime.now.in_time_zone - 5.day)

      assignment_created = @assignment.created_at
      assignment_due_dates = DueDate.where(parent_id: @response_map.reviewed_object_id)

      hyper_link = submitted_hyperlink(@round, @response_map, assignment_created, assignment_due_dates)
      expect(hyper_link).to eq('https://wiki.archlinux.org/123')
    end

    it 'should return https://wiki.archlinux.org/123 if only a work was submitted on time' do
      create(:deadline_right, name: 'No')
      create(:deadline_right, name: 'Late')
      create(:deadline_right, name: 'OK')
      create(:submission_record, assignment_id: @assignment.id, team_id: @reviewee.id, operation: 'Submit Hyperlink', content: 'https://wiki.archlinux.org/', created_at: DateTime.now.in_time_zone - 8.day)
      create(:submission_record, assignment_id: @assignment.id, team_id: @reviewee.id, operation: 'Submit Hyperlink', content: 'https://wiki.archlinux.org/123', created_at: DateTime.now.in_time_zone - 6.day)
      create(:response, response_map: @response_map)
      create(:assignment_due_date, assignment: @assignment, parent_id: @assignment.id, round: 1, due_at: DateTime.now.in_time_zone - 10.day)
      create(:assignment_due_date, assignment: @assignment, parent_id: @assignment.id, round: 2, due_at: DateTime.now.in_time_zone - 5.day)

      assignment_created = @assignment.created_at
      assignment_due_dates = DueDate.where(parent_id: @response_map.reviewed_object_id)

      hyper_link = submitted_hyperlink(@round, @response_map, assignment_created, assignment_due_dates)
      expect(hyper_link).to eq('https://wiki.archlinux.org/123')
    end

    it 'should return https://wiki.archlinux.org/ if only a work was submitted on time' do
      create(:deadline_right, name: 'No')
      create(:deadline_right, name: 'Late')
      create(:deadline_right, name: 'OK')
      create(:submission_record, assignment_id: @assignment.id, team_id: @reviewee.id, operation: 'Submit Hyperlink', content: 'https://wiki.archlinux.org/', created_at: DateTime.now.in_time_zone - 12.day)
      create(:submission_record, assignment_id: @assignment.id, team_id: @reviewee.id, operation: 'Submit Hyperlink', content: 'https://wiki.archlinux.org/123', created_at: DateTime.now.in_time_zone - 4.day)
      create(:response, response_map: @response_map)
      create(:assignment_due_date, assignment: @assignment, parent_id: @assignment.id, round: 1, due_at: DateTime.now.in_time_zone - 10.day)
      create(:assignment_due_date, assignment: @assignment, parent_id: @assignment.id, round: 2, due_at: DateTime.now.in_time_zone - 5.day)

      assignment_created = @assignment.created_at
      assignment_due_dates = DueDate.where(parent_id: @response_map.reviewed_object_id)

      hyper_link = submitted_hyperlink(@round, @response_map, assignment_created, assignment_due_dates)
      expect(hyper_link).to eq('https://wiki.archlinux.org/')
    end


    it 'should return https://wiki.archlinux.org/ if only a work was Submit Hyperlink' do
      create(:deadline_right, name: 'No')
      create(:deadline_right, name: 'Late')
      create(:deadline_right, name: 'OK')
      create(:submission_record, assignment_id: @assignment.id, team_id: @reviewee.id, operation: 'Submit Hyperlink', content: 'https://wiki.archlinux.org/', created_at: DateTime.now.in_time_zone - 12.day)
      create(:submission_record, assignment_id: @assignment.id, team_id: @reviewee.id, operation: 'Not Submit Hyperlink', content: 'https://wiki.archlinux.org/123', created_at: DateTime.now.in_time_zone - 6.day)
      create(:response, response_map: @response_map)
      create(:assignment_due_date, assignment: @assignment, parent_id: @assignment.id, round: 1, due_at: DateTime.now.in_time_zone - 10.day)
      create(:assignment_due_date, assignment: @assignment, parent_id: @assignment.id, round: 2, due_at: DateTime.now.in_time_zone - 5.day)

      assignment_created = @assignment.created_at
      assignment_due_dates = DueDate.where(parent_id: @response_map.reviewed_object_id)

      hyper_link = submitted_hyperlink(@round, @response_map, assignment_created, assignment_due_dates)
      expect(hyper_link).to eq('https://wiki.archlinux.org/')
    end

get_team_reviewed_link_name

This method checks if the max_team_size is 1 or not and gives appropriate team reviewed link name. Given the input max_team_size, response, reviewee_id, ip_address, if the team size is 1, it is expected to get the return of the student's name. If not, it is expected to return "Team 1".

    it 'should return (Team_1) if max_team_size = 3' do
      max_team_size = 3
      @response = create(:response, response_map: @response_map)
      ip_address = '0.0.0.0'
      reviewed_team_name = get_team_reviewed_link_name(max_team_size, @response, @reviewee.id, ip_address)
      expect(reviewed_team_name).to eq('(Team_1)')
    end

    it 'should return (Team_1) if max_team_size = 2' do
      max_team_size = 2
      @response = create(:response, response_map: @response_map)
      ip_address = '0.0.0.0'
      reviewed_team_name = get_team_reviewed_link_name(max_team_size, @response, @reviewee.id, ip_address)
      expect(reviewed_team_name).to eq('(Team_1)')
    end

    it 'should return (Adam) if max_team_size = 1' do
      max_team_size = 1
      student = create(:student, fullname: 'Adam')
      create(:team_user, user: student, team: @reviewee)

      @response = create(:response, response_map: @response_map)
      ip_address = '0.0.0.0'
      reviewed_team_name = get_team_reviewed_link_name(max_team_size, @response, @reviewee.id, ip_address)
      expect(reviewed_team_name).to eq('(Adam)')
    end

    it 'should return (Team_1) if max_team_size = 0' do
      max_team_size = 0
      @response = create(:response, response_map: @response_map)
      ip_address = '0.0.0.0'
      reviewed_team_name = get_team_reviewed_link_name(max_team_size, @response, @reviewee.id, ip_address)
      expect(reviewed_team_name).to eq('(Team_1)')
    end

sort_reviewer_by_review_volume_desc

This method sorts the reviewer depending on the length of the content of the review. It is sorted in descent order, and follows the order of create if the length of the reviews are the same. In the first test, the length of comment following in the descent order is 2 > 3 > 1, therefore, it returns in the array[@reviewer_2, @reviewer_3, @reviewer_1]. In the second test, since @response_1 has the same length of comment with @response_3 and @response_1 is followed by @response_3, this method returns the array[@reviewer_2, @reviewer_1, @reviewer_3].

it 'the order should be 2-3-1 if the order of comment volume is 2 > 3 > 1' do
      @response_1 = create(:response, response_map: @response_map_1, additional_comment: 'good')
      @response_2 = create(:response, response_map: @response_map_2, additional_comment: 'Good job with clear code')
      @response_3 = create(:response, response_map: @response_map_3, additional_comment: 'goodclear code')

      @reviewers = Array[@reviewer_1, @reviewer_2, @reviewer_3]
      @reviewers_for_test = Array[@reviewer_2, @reviewer_3, @reviewer_1]

      sort_reviewer_by_review_volume_desc
      expect(@reviewers).to eq(@reviewers_for_test)
    end

    it 'the order should be 2-1-3 if the comment volume is 2 > 1 = 3' do
      @response_1 = create(:response, response_map: @response_map_1, additional_comment: 'good job')
      @response_2 = create(:response, response_map: @response_map_2, additional_comment: 'Good job with clear code')
      @response_3 = create(:response, response_map: @response_map_3, additional_comment: 'clear code')

      @reviewers = Array[@reviewer_1, @reviewer_2, @reviewer_3]
      @reviewers_for_test = Array[@reviewer_2, @reviewer_1, @reviewer_3]

      sort_reviewer_by_review_volume_desc
      expect(@reviewers).to eq(@reviewers_for_test)
    end

    it 'the order should be 1-2-3 if the comment volume is 1 = 2 = 3' do
      @response_1 = create(:response, response_map: @response_map_1, additional_comment: 'good job')
      @response_2 = create(:response, response_map: @response_map_2, additional_comment: 'clear code')
      @response_3 = create(:response, response_map: @response_map_3, additional_comment: 'nice bro')

      @reviewers = Array[@reviewer_1, @reviewer_2, @reviewer_3]
      @reviewers_for_test = Array[@reviewer_1, @reviewer_2, @reviewer_3]

      sort_reviewer_by_review_volume_desc
      expect(@reviewers).to eq(@reviewers_for_test)
    end

list_review_submission

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 

get_certain_review_and_feedback_response_map

    it 'should return the number of responses given in round 1 reviews' do
      get_each_review_and_feedback_response_map(@reviewer)

      # rspan means the all peer reviews one student received, including unfinished one
      # retrieved from method call in review_mapping_helper.rb file
      expect(@rspan_round_one).to eq 1
    end

    it 'should return the number of responses given in round 2 reviews' do
      get_each_review_and_feedback_response_map(@reviewer)

      # rspan means the all peer reviews one student received, including unfinished one
      # retrieved from method call in review_mapping_helper.rb file
      expect(@rspan_round_two).to eq 1
    end

    it 'should return the number of responses given in round 3 reviews' do
      # have to add in third response, did not in before action for nil scenario
      @response_3 = create(:response, response_map: @response_map_3, round: 3)
      @response_list << @response_3
      @feedback_response_map_list << FeedbackResponseMap.create(reviewed_object_id: @response_3.id, reviewer_id: @reviewer.id)
      @all_review_response_ids << @response_3.id

      get_each_review_and_feedback_response_map(@reviewer)

      # rspan means the all peer reviews one student received, including unfinished one
      # retrieved from method call in review_mapping_helper.rb file
      expect(@rspan_round_three).to eq 1
    end

    it 'should return 0 responses for no round 3 reviews' do
      # no feedback responses set before method call
      get_each_review_and_feedback_response_map(@reviewer)

      # rspan means the all peer reviews one student received, including unfinished one
      # retrieved from method call in review_mapping_helper.rb file
      expect(@rspan_round_three).to eq 0
    end

get_css_style_for_calibration_report

The method transfers the variable diff, the difference between the student's and the instructor's answer into css style. A dictionary is created as dict = {0 => 'c5',1 => 'c4',2 => 'c3',3 => 'c2'}. In the first unit test, "0" set as the the diff is expected to return c5. In the second test, "-1" is a negative integer, so the absolute value is used to return c4. In the third test, since "6" is not in the key of dict, according to the function, it should return c1.

    it 'should return correct css class' do
      css_class_0 = helper.get_css_style_for_calibration_report(0)
      css_class_1 = helper.get_css_style_for_calibration_report(-1)
      css_class_6 = helper.get_css_style_for_calibration_report(6)
      expect(css_class_0). to eq('c5')
      expect(css_class_1). to eq('c4')
      expect(css_class_6). to eq('c1')
    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.