From 99faa37a12b68af6ab4ee4f18532700540ba707e Mon Sep 17 00:00:00 2001 From: brwali Date: Tue, 26 Nov 2024 09:09:44 -0500 Subject: [PATCH] Fixed controller tests to conform to updated code, fixed spellling errors causing the linting to fail --- app/models/mentor_management.rb | 2 +- app/views/shared_scripts/_user_list.html.erb | 2 +- lib/scoring.rb | 4 ++-- spec/controllers/metrics_controller_spec.rb | 7 +++---- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/models/mentor_management.rb b/app/models/mentor_management.rb index 54a71096463..0adfdf5a468 100644 --- a/app/models/mentor_management.rb +++ b/app/models/mentor_management.rb @@ -3,7 +3,7 @@ class MentorManagement # # 1) Find all assignment participants for the # assignment with id [assignment_id] whose - # duty is the same as [Particpant#DUTY_MENTOR]. + # duty is the same as [Participant#DUTY_MENTOR]. # 2) Count the number of teams those participants # are a part of, acting as a proxy for the # number of teams they mentor. diff --git a/app/views/shared_scripts/_user_list.html.erb b/app/views/shared_scripts/_user_list.html.erb index 0a3ff3a3187..01d0657f695 100644 --- a/app/views/shared_scripts/_user_list.html.erb +++ b/app/views/shared_scripts/_user_list.html.erb @@ -16,7 +16,7 @@ Submit Review Take quiz - + <% if params[:model] == 'Assignment' %> Mentor <% end %> diff --git a/lib/scoring.rb b/lib/scoring.rb index e4eac5aa6c8..c0fc0f52a1d 100644 --- a/lib/scoring.rb +++ b/lib/scoring.rb @@ -86,7 +86,7 @@ def compute_total_score(assignment, scores) # Computes and returns the scores of assignment for participants and teams # Returns data in the format of # { - # :particpant => { + # :participant => { # : => participant_scores(participant, questions), # : => participant_scores(participant, questions) # }, @@ -126,7 +126,7 @@ def review_grades(assignment, questions) # Return scores that this participant has been given # Returns data in the format of # { - # :total_score => participant.grade ? particpant.grade : compute_total_score(assignment, scores) + # :total_score => participant.grade ? participant.grade : compute_total_score(assignment, scores) # :max_pts_available => topic.micropayment if assignment.topics? # :participant => participant, # :questionnaire_symbol1 => { diff --git a/spec/controllers/metrics_controller_spec.rb b/spec/controllers/metrics_controller_spec.rb index 06e25131bd9..5bf279e439f 100644 --- a/spec/controllers/metrics_controller_spec.rb +++ b/spec/controllers/metrics_controller_spec.rb @@ -115,7 +115,6 @@ describe '#show' do context 'when user hasn\'t logged in to GitHub' do before(:each) do - params = {id: 900} allow(controller).to receive(:authorize_github) allow(controller).to receive(:github_metrics_for_submission) allow(controller).to receive(:show) @@ -123,8 +122,8 @@ end it 'redirects user to GitHub authorization page' do - params = {id: 900} - get :show, params + params = {id: 900, assignment_id: assignment.id} + get :show, params: params expect(response.status).to eq(302) #redirected end end @@ -244,7 +243,7 @@ it 'gets data from GitHub api v4(graphql)' do response = controller.query_commit_statistics("{\"team\":\"rails\",\"players\":\"36\"}") - expect(response).to eq("message" => "Bad credentials", "documentation_url" => "https://docs.github.com/graphql") + expect(response).to eq("message" => "Bad credentials", "documentation_url" => "https://docs.github.com/graphql", "status"=>"401") end end