RuboCop: Style/RedundantParentheses

[skip-stages=Flakey]

auto-corrected

Change-Id: I773f1128042a03265d6e925cfd86d69f0dc11892
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/277877
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Cody Cutrer 2021-11-10 11:39:45 -07:00
parent 8125858d27
commit b2d5e59698
43 changed files with 55 additions and 54 deletions

View File

@ -140,6 +140,8 @@ Style/PerlBackrefs:
Enabled: false # Regexp.last_match(1) is far worse than $1 Enabled: false # Regexp.last_match(1) is far worse than $1
Style/RedundantInterpolation: Style/RedundantInterpolation:
Severity: error Severity: error
Style/RedundantParentheses:
Severity: error
Style/SpecialGlobalVars: Style/SpecialGlobalVars:
Enabled: false # $! and $? are fine Enabled: false # $! and $? are fine
Style/WhileUntilModifier: Style/WhileUntilModifier:

View File

@ -1549,7 +1549,7 @@ class ApplicationController < ActionController::Base
end end
def log_gets def log_gets
if @page_view && !request.xhr? && request.get? && (((response.media_type || "").to_s.match(/html/)) || if @page_view && !request.xhr? && request.get? && ((response.media_type || "").to_s.match(/html/) ||
((Setting.get('create_get_api_page_views', 'true') == 'true') && api_request?)) ((Setting.get('create_get_api_page_views', 'true') == 'true') && api_request?))
@page_view.render_time ||= (Time.now.utc - @page_before_render) rescue nil @page_view.render_time ||= (Time.now.utc - @page_before_render) rescue nil
@page_view_update = true @page_view_update = true

View File

@ -539,9 +539,9 @@ class DiscussionTopicsController < ApplicationController
if @topic.assignment.present? if @topic.assignment.present?
hash[:ATTRIBUTES][:assignment][:assignment_overrides] = hash[:ATTRIBUTES][:assignment][:assignment_overrides] =
(assignment_overrides_json( assignment_overrides_json(
@topic.assignment.overrides_for(@current_user, ensure_set_not_empty: true) @topic.assignment.overrides_for(@current_user, ensure_set_not_empty: true)
)) )
hash[:ATTRIBUTES][:assignment][:has_student_submissions] = @topic.assignment.has_student_submissions? hash[:ATTRIBUTES][:assignment][:has_student_submissions] = @topic.assignment.has_student_submissions?
end end
@ -1395,7 +1395,7 @@ class DiscussionTopicsController < ApplicationController
def process_lock_parameters(discussion_topic_hash) def process_lock_parameters(discussion_topic_hash)
# Handle locking/unlocking (overrides workflow state if provided). It appears that the locked param as a hash # Handle locking/unlocking (overrides workflow state if provided). It appears that the locked param as a hash
# is from old code and is not being used. Verification requested. # is from old code and is not being used. Verification requested.
if !(@topic.lock_at_changed?) if !@topic.lock_at_changed?
if params.has_key?(:locked) && !params[:locked].is_a?(Hash) if params.has_key?(:locked) && !params[:locked].is_a?(Hash)
should_lock = value_to_boolean(params[:locked]) should_lock = value_to_boolean(params[:locked])
if should_lock != @topic.locked? if should_lock != @topic.locked?

View File

@ -82,6 +82,6 @@ class FilePreviewsController < ApplicationController
def download_allowed(attachment, user, session, params) def download_allowed(attachment, user, session, params)
verifier_checker = Attachments::Verification.new(attachment) verifier_checker = Attachments::Verification.new(attachment)
(params[:verifier] && verifier_checker.valid_verifier_for_permission?(params[:verifier], :download, session)) || (params[:verifier] && verifier_checker.valid_verifier_for_permission?(params[:verifier], :download, session)) ||
(attachment.grants_right?(user, session, :download)) attachment.grants_right?(user, session, :download)
end end
end end

View File

@ -544,7 +544,7 @@ class FilesController < ApplicationController
if params[:download] if params[:download]
if (params[:verifier] && verifier_checker.valid_verifier_for_permission?(params[:verifier], :download, session)) || if (params[:verifier] && verifier_checker.valid_verifier_for_permission?(params[:verifier], :download, session)) ||
(@attachment.grants_right?(@current_user, session, :download)) @attachment.grants_right?(@current_user, session, :download)
disable_page_views if params[:preview] disable_page_views if params[:preview]
begin begin
send_attachment(@attachment) send_attachment(@attachment)

View File

@ -102,7 +102,7 @@ class Quizzes::QuizSubmissionsController < ApplicationController
if !@submission || (@quiz.ip_filter && !@quiz.valid_ip?(request.remote_ip)) if !@submission || (@quiz.ip_filter && !@quiz.valid_ip?(request.remote_ip))
nil nil
elsif is_previewing? || (@submission.temporary_user_code == temporary_user_code(false)) || elsif is_previewing? || (@submission.temporary_user_code == temporary_user_code(false)) ||
(@submission.grants_right?(@current_user, session, :update)) @submission.grants_right?(@current_user, session, :update)
if !@submission.completed? && (!@submission.overdue? || is_previewing?) if !@submission.completed? && (!@submission.overdue? || is_previewing?)
if params[:action] == 'record_answer' if params[:action] == 'record_answer'
if (last_question = params[:last_question_id]) if (last_question = params[:last_question_id])

View File

@ -1218,7 +1218,7 @@ module ApplicationHelper
end end
def planner_enabled? def planner_enabled?
!!(@current_user&.has_student_enrollment?) || !!@current_user&.has_student_enrollment? ||
(Account.site_admin.feature_enabled?(:k5_parent_support) && @current_user&.roles(@domain_root_account)&.include?('observer') && k5_user?) (Account.site_admin.feature_enabled?(:k5_parent_support) && @current_user&.roles(@domain_root_account)&.include?('observer') && k5_user?)
end end

View File

@ -31,8 +31,8 @@ module CalendarEventsHelper
cal_options = {} cal_options = {}
event = options.delete(:event) event = options.delete(:event)
if event if event
cal_options[:anchor] = { :month => (event.try_rescue(:start_at).try_rescue(:month)), cal_options[:anchor] = { :month => event.try_rescue(:start_at).try_rescue(:month),
:year => (event.try_rescue(:start_at).try_rescue(:year)) }.to_json :year => event.try_rescue(:start_at).try_rescue(:year) }.to_json
end end
# Use a explicit "return_to" option first, absent that, use calendar_url_for # Use a explicit "return_to" option first, absent that, use calendar_url_for
clean_return_to( clean_return_to(

View File

@ -3338,7 +3338,7 @@ class Assignment < ActiveRecord::Base
return unless assignments.any? return unless assignments.any?
assmnt_ids_with_subs ||= assignment_ids_with_submissions(assignments.map(&:id)) assmnt_ids_with_subs ||= assignment_ids_with_submissions(assignments.map(&:id))
assignments.each { |a| a.can_unpublish = !(assmnt_ids_with_subs.include?(a.id)) } assignments.each { |a| a.can_unpublish = !assmnt_ids_with_subs.include?(a.id) }
end end
def self.assignment_ids_with_submissions(assignment_ids) def self.assignment_ids_with_submissions(assignment_ids)

View File

@ -1984,7 +1984,7 @@ class Course < ActiveRecord::Base
end end
overall_status = "error" overall_status = "error"
overall_status = "unpublished" unless found_statuses.size > 0 overall_status = "unpublished" unless found_statuses.size > 0
overall_status = (%w{error unpublished pending publishing published unpublishable}).detect { |s| found_statuses.include?(s) } || overall_status overall_status = %w{error unpublished pending publishing published unpublishable}.detect { |s| found_statuses.include?(s) } || overall_status
return enrollments, overall_status return enrollments, overall_status
end end

View File

@ -929,9 +929,9 @@ class DiscussionTopic < ActiveRecord::Base
topics.each do |topic| topics.each do |topic|
if topic.assignment_id if topic.assignment_id
topic.can_unpublish = !(assmnt_ids_with_subs.include?(topic.assignment_id)) topic.can_unpublish = !assmnt_ids_with_subs.include?(topic.assignment_id)
else else
topic.can_unpublish = !(topic_ids_with_entries.include?(topic.id)) topic.can_unpublish = !topic_ids_with_entries.include?(topic.id)
end end
end end
end end
@ -1360,7 +1360,7 @@ class DiscussionTopic < ActiveRecord::Base
def users_with_permissions(users) def users_with_permissions(users)
permission = self.is_announcement ? :read_announcements : :read_forum permission = self.is_announcement ? :read_announcements : :read_forum
course = self.course course = self.course
if !(course.is_a?(Course)) if !course.is_a?(Course)
return users.select do |u| return users.select do |u|
self.is_announcement ? self.context.grants_right?(u, :read_announcements) : self.context.grants_right?(u, :read_forum) self.is_announcement ? self.context.grants_right?(u, :read_announcements) : self.context.grants_right?(u, :read_forum)
end end

View File

@ -381,7 +381,7 @@ module Importers
return nil unless (uri = URI.parse(original_url)) return nil unless (uri = URI.parse(original_url))
custom_fields_query = custom_fields.map { |k, v| "custom_#{CGI.escape(k)}=#{CGI.escape(v)}" }.join("&") custom_fields_query = custom_fields.map { |k, v| "custom_#{CGI.escape(k)}=#{CGI.escape(v)}" }.join("&")
uri.query = uri.query.present? ? ([uri.query, custom_fields_query].join("&")) : custom_fields_query uri.query = uri.query.present? ? [uri.query, custom_fields_query].join("&") : custom_fields_query
new_url = uri.to_s new_url = uri.to_s
if new_url.length < MAX_URL_LENGTH if new_url.length < MAX_URL_LENGTH

View File

@ -24,7 +24,7 @@ module Quizzes::LogAuditing
class QuestionAnsweredEventExtractor class QuestionAnsweredEventExtractor
EVENT_TYPE = Quizzes::QuizSubmissionEvent::EVT_QUESTION_ANSWERED EVENT_TYPE = Quizzes::QuizSubmissionEvent::EVT_QUESTION_ANSWERED
RE_QUESTION_ANSWER_FIELD = /^question_(\d+)_?/ RE_QUESTION_ANSWER_FIELD = /^question_(\d+)_?/
SQL_FIND_PREDECESSORS = ( SQL_FIND_PREDECESSORS =
<<~SQL <<~SQL
created_at >= :started_at created_at >= :started_at
AND created_at <= :created_at AND created_at <= :created_at
@ -32,7 +32,7 @@ module Quizzes::LogAuditing
AND attempt = :attempt AND attempt = :attempt
AND event_type = '#{EVENT_TYPE}' AND event_type = '#{EVENT_TYPE}'
SQL SQL
).freeze .freeze
# Main API. Extract, optimize, and persist an answer event from a given # Main API. Extract, optimize, and persist an answer event from a given
# submission data construct. # submission data construct.

View File

@ -1345,7 +1345,7 @@ class Quizzes::Quiz < ActiveRecord::Base
.pluck("s.quiz_id") .pluck("s.quiz_id")
quizzes.each do |quiz| quizzes.each do |quiz|
quiz.can_unpublish = !(quiz_ids_with_subs.include?(quiz.id)) && quiz.can_unpublish = !quiz_ids_with_subs.include?(quiz.id) &&
(quiz.assignment_id.nil? || !assmnt_ids_with_subs.include?(quiz.assignment_id)) (quiz.assignment_id.nil? || !assmnt_ids_with_subs.include?(quiz.assignment_id))
end end
end end

View File

@ -53,13 +53,12 @@ module Quizzes
private private
def message def message
@message ||= ( @message ||=
Conversation.build_message( Conversation.build_message(
sender, sender,
body, body,
root_account_id: root_account_id root_account_id: root_account_id
) )
)
end end
def body def body

View File

@ -1299,7 +1299,7 @@ class User < ActiveRecord::Base
(self == user && self.mfa_settings != :required) || (self == user && self.mfa_settings != :required) ||
# a site_admin with permission to reset_any_mfa # a site_admin with permission to reset_any_mfa
(Account.site_admin.grants_right?(user, :reset_any_mfa)) || Account.site_admin.grants_right?(user, :reset_any_mfa) ||
# an admin can reset another user's MFA only if they can manage *all* # an admin can reset another user's MFA only if they can manage *all*
# of the user's pseudonyms # of the user's pseudonyms
(self != user && self.pseudonyms.shard(self).all? do |p| (self != user && self.pseudonyms.shard(self).all? do |p|

View File

@ -267,7 +267,7 @@ module CanvasCache
unless NON_KEY_COMMANDS.include?(command) unless NON_KEY_COMMANDS.include?(command)
message[:key] = if command == :mset message[:key] = if command == :mset
# This is an array with a single element: an array alternating key/values # This is an array with a single element: an array alternating key/values
request.first { |v| v.first }.select.with_index { |_, i| (i) % 2 == 0 } request.first { |v| v.first }.select.with_index { |_, i| i % 2 == 0 }
elsif command == :mget elsif command == :mget
request request
else else

View File

@ -70,7 +70,7 @@ module LuckySneaks
value = /([A-Za-z0-9]+|('[^']*?'|"[^"]*?"))/ value = /([A-Za-z0-9]+|('[^']*?'|"[^"]*?"))/
attr = /(#{name}(\s*=\s*#{value})?)/ attr = /(#{name}(\s*=\s*#{value})?)/
rx = /<[!\/?\[]?(#{name}|--)(\s+(#{attr}(\s+#{attr})*))?\s*([!\/?\]]+|--)?>/ rx = /<[!\/?\[]?(#{name}|--)(\s+(#{attr}(\s+#{attr})*))?\s*([!\/?\]]+|--)?>/
(leave_whitespace) ? gsub(rx, "").strip : gsub(rx, "").gsub(/\s+/, " ").strip leave_whitespace ? gsub(rx, "").strip : gsub(rx, "").gsub(/\s+/, " ").strip
end end
# Converts HTML entities into the respective non-accented letters. Examples: # Converts HTML entities into the respective non-accented letters. Examples:

View File

@ -227,7 +227,7 @@ module AccountReports
account_report.message = message account_report.message = message
failed_report(account_report) unless csv failed_report(account_report) unless csv
if account_report.workflow_state == 'aborted' if account_report.workflow_state == 'aborted'
account_report.parameters["extra_text"] = (I18n.t('Report has been aborted')) account_report.parameters["extra_text"] = I18n.t('Report has been aborted')
else else
account_report.workflow_state = csv ? 'complete' : 'error' account_report.workflow_state = csv ? 'complete' : 'error'
end end

View File

@ -43,9 +43,9 @@ describe "Respondus SOAP API", type: :request do
soap = SOAP::RPC::Driver.new('test', "urn:RespondusAPI") soap = SOAP::RPC::Driver.new('test', "urn:RespondusAPI")
soap.options['protocol.streamhandler'] = 'SpecStreamHandler' soap.options['protocol.streamhandler'] = 'SpecStreamHandler'
soap.add_method(method, soap.add_method(method,
'userName', 'password', 'context', *(args.map(&:first))) 'userName', 'password', 'context', *args.map(&:first))
streamHandler = soap.proxy.streamhandler streamHandler = soap.proxy.streamhandler
method_args = [userName, password, context, *(args.map(&:last))] method_args = [userName, password, context, *args.map(&:last)]
streamHandler.capture(soap, method, *method_args) do |s_body, s_headers| streamHandler.capture(soap, method, *method_args) do |s_body, s_headers|
post "/api/respondus/soap", params: s_body, headers: s_headers post "/api/respondus/soap", params: s_body, headers: s_headers
response response

View File

@ -269,7 +269,7 @@ module Api::V1::Assignment
if assignment.quiz? if assignment.quiz?
hash['quiz_id'] = assignment.quiz.id hash['quiz_id'] = assignment.quiz.id
hash['anonymous_submissions'] = !!(assignment.quiz.anonymous_submissions) hash['anonymous_submissions'] = !!assignment.quiz.anonymous_submissions
end end
if assignment.allowed_extensions.present? if assignment.allowed_extensions.present?

View File

@ -322,7 +322,7 @@ module BasicLTI
if error_message if error_message
self.code_major = 'failure' self.code_major = 'failure'
self.description = error_message self.description = error_message
elsif assignment.grading_type != "pass_fail" && (assignment.points_possible.nil?) elsif assignment.grading_type != "pass_fail" && assignment.points_possible.nil?
unless (submission = existing_submission) unless (submission = existing_submission)
submission = Submission.create!(submission_hash.merge(:user => user, submission = Submission.create!(submission_hash.merge(:user => user,

View File

@ -82,7 +82,7 @@ module BasicLTI
end end
def grading_period_closed? def grading_period_closed?
!!(submission.grading_period&.closed?) !!submission.grading_period&.closed?
end end
def valid?(launch_url, grade) def valid?(launch_url, grade)

View File

@ -103,7 +103,7 @@ module Canvas
{ {
# ActionDispatch::Request#remote_ip has proxy smarts # ActionDispatch::Request#remote_ip has proxy smarts
'REMOTE_ADDR' => req.remote_ip, 'REMOTE_ADDR' => req.remote_ip,
'QUERY_STRING' => (f.filter_query_string("?" + (query_string || ''))), 'QUERY_STRING' => f.filter_query_string("?" + (query_string || '')),
'REQUEST_URI' => f.filter_uri(req.url), 'REQUEST_URI' => f.filter_uri(req.url),
'path_parameters' => f.filter_params(req.path_parameters.dup).inspect, 'path_parameters' => f.filter_params(req.path_parameters.dup).inspect,
'query_parameters' => f.filter_params(req.query_parameters.dup).inspect, 'query_parameters' => f.filter_params(req.query_parameters.dup).inspect,

View File

@ -491,7 +491,7 @@ module Canvas::LiveEvents
account_uuid: assoc.account.uuid, account_uuid: assoc.account.uuid,
created_at: assoc.created_at, created_at: assoc.created_at,
updated_at: assoc.updated_at, updated_at: assoc.updated_at,
is_admin: !(assoc.account.root_account.cached_all_account_users_for(assoc.user).empty?), is_admin: !assoc.account.root_account.cached_all_account_users_for(assoc.user).empty?,
}) })
end end

View File

@ -269,7 +269,7 @@ module CC
node.resource_link_lookup_uuid resource_link.lookup_uuid if resource_link.present? node.resource_link_lookup_uuid resource_link.lookup_uuid if resource_link.present?
end end
node.tag!(:turnitin_settings, (assignment.send(:turnitin_settings).to_json)) if assignment.turnitin_enabled || assignment.vericite_enabled node.tag!(:turnitin_settings, assignment.send(:turnitin_settings).to_json) if assignment.turnitin_enabled || assignment.vericite_enabled
if assignment.assignment_configuration_tool_lookup_ids.present? if assignment.assignment_configuration_tool_lookup_ids.present?
resource_codes = assignment.tool_settings_tool.try(:resource_codes) || {} resource_codes = assignment.tool_settings_tool.try(:resource_codes) || {}
node.similarity_detection_tool({ node.similarity_detection_tool({

View File

@ -402,7 +402,7 @@ class ContentZipper
def add_submission(submission, students, zipfile) def add_submission(submission, students, zipfile)
@submission = submission @submission = submission
@logger.debug(" checking submission for #{(submission.user.id)}") @logger.debug(" checking submission for #{submission.user.id}")
users_name = get_user_name(students, submission) unless @assignment.anonymize_students? users_name = get_user_name(students, submission) unless @assignment.anonymize_students?
filename = get_filename(users_name, submission) filename = get_filename(users_name, submission)

View File

@ -47,7 +47,7 @@ module MessageBus
return @base_string if @suffix.nil? return @base_string if @suffix.nil?
extension = "-#{@suffix}" extension = "-#{@suffix}"
return @base_string if @base_string[(-1 * (extension.length))..] == extension return @base_string if @base_string[(-1 * extension.length)..] == extension
@base_string + extension @base_string + extension
end end

View File

@ -67,8 +67,8 @@ module SIS
# only update the name/short_name on new records, and ones that haven't been changed # only update the name/short_name on new records, and ones that haven't been changed
# since the last sis import # since the last sis import
course.name = long_name if long_name.present? && (course.new_record? || (!course.stuck_sis_fields.include?(:name))) course.name = long_name if long_name.present? && (course.new_record? || !course.stuck_sis_fields.include?(:name))
course.short_name = short_name if short_name.present? && (course.new_record? || (!course.stuck_sis_fields.include?(:short_name))) course.short_name = short_name if short_name.present? && (course.new_record? || !course.stuck_sis_fields.include?(:short_name))
course.sis_source_id = abstract_course_id course.sis_source_id = abstract_course_id
if status =~ /active/i if status =~ /active/i

View File

@ -76,7 +76,7 @@ module SIS
end end
# only update the name on new records, and ones that haven't been changed since the last sis import # only update the name on new records, and ones that haven't been changed since the last sis import
account.name = name if name.present? && (account.new_record? || (!account.stuck_sis_fields.include?(:name))) account.name = name if name.present? && (account.new_record? || !account.stuck_sis_fields.include?(:name))
account.integration_id = integration_id account.integration_id = integration_id
account.sis_source_id = account_id account.sis_source_id = account_id

View File

@ -48,8 +48,8 @@ module StickySisFields
def stuck_sis_fields=(fields) def stuck_sis_fields=(fields)
fields = [fields] if fields.is_a? String fields = [fields] if fields.is_a? String
clear_sis_stickiness(*(stuck_sis_fields.to_a)) clear_sis_stickiness(*stuck_sis_fields.to_a)
add_sis_stickiness(*(fields.map(&:to_sym).to_set)) add_sis_stickiness(*fields.map(&:to_sym))
end end
# clear stickiness on a set of fields # clear stickiness on a set of fields

View File

@ -29,7 +29,7 @@ describe 'Account Reports API', type: :request do
@report.user = @admin @report.user = @admin
@report.progress = rand(100) @report.progress = rand(100)
@report.start_at = DateTime.now @report.start_at = DateTime.now
@report.end_at = (Time.now + (rand(60 * 60 * 4))).to_datetime @report.end_at = (Time.now + rand(60 * 60 * 4)).to_datetime
@report.report_type = "student_assignment_outcome_map_csv" @report.report_type = "student_assignment_outcome_map_csv"
@report.parameters = HashWithIndifferentAccess['param' => 'test', 'error' => 'failed'] @report.parameters = HashWithIndifferentAccess['param' => 'test', 'error' => 'failed']

View File

@ -2564,7 +2564,7 @@ describe AssignmentsApiController, type: :request do
overrides = [{ overrides = [{
'student_ids' => opts[:student_ids] || [], 'student_ids' => opts[:student_ids] || [],
'title' => opts[:title] || 'adhoc override', 'title' => opts[:title] || 'adhoc override',
'due_at' => opts[:adhoc_due_at] || (5.days.from_now).iso8601 'due_at' => opts[:adhoc_due_at] || 5.days.from_now.iso8601
}] }]
overrides.concat(opts[:additional_overrides]) if opts[:additional_overrides] overrides.concat(opts[:additional_overrides]) if opts[:additional_overrides]

View File

@ -4412,7 +4412,7 @@ describe ContentImportsController, type: :request do
status_url = data['status_url'] status_url = data['status_url']
api_call(:get, status_url, { :controller => 'content_imports', :action => 'copy_course_status', :course_id => @copy_to.to_param, :id => data['id'].to_param, :format => 'json' }) api_call(:get, status_url, { :controller => 'content_imports', :action => 'copy_course_status', :course_id => @copy_to.to_param, :id => data['id'].to_param, :format => 'json' })
(JSON.parse(response.body)).tap do |res| JSON.parse(response.body).tap do |res|
expect(res['workflow_state']).to eq 'started' expect(res['workflow_state']).to eq 'started'
expect(res['progress']).to eq 0 expect(res['progress']).to eq 0
end end
@ -4423,7 +4423,7 @@ describe ContentImportsController, type: :request do
expect(cm.content_export.error_messages).to eq [] expect(cm.content_export.error_messages).to eq []
api_call(:get, status_url, { :controller => 'content_imports', :action => 'copy_course_status', :course_id => @copy_to.to_param, :id => data['id'].to_param, :format => 'json' }) api_call(:get, status_url, { :controller => 'content_imports', :action => 'copy_course_status', :course_id => @copy_to.to_param, :id => data['id'].to_param, :format => 'json' })
(JSON.parse(response.body)).tap do |res| JSON.parse(response.body).tap do |res|
expect(res['workflow_state']).to eq 'completed' expect(res['workflow_state']).to eq 'completed'
expect(res['progress']).to eq 100 expect(res['progress']).to eq 100
end end

View File

@ -130,7 +130,7 @@ describe Lti::IMS::AuthenticationController do
verifier: verifier, verifier: verifier,
canvas_domain: redirect_domain canvas_domain: redirect_domain
}, },
(1.year.from_now) 1.year.from_now
) )
jws[0...-1] jws[0...-1]
end end

View File

@ -107,7 +107,7 @@ describe Types::CourseType do
start_date: 2.days.ago, start_date: 2.days.ago,
end_date: 2.days.from_now end_date: 2.days.from_now
@term1_assignment1 = course.assignments.create! name: "asdf", @term1_assignment1 = course.assignments.create! name: "asdf",
due_at: (1.5).weeks.ago due_at: 1.5.weeks.ago
@term2_assignment1 = course.assignments.create! name: ";lkj", @term2_assignment1 = course.assignments.create! name: ";lkj",
due_at: Date.today due_at: Date.today
end end

View File

@ -1809,7 +1809,7 @@ describe GradeCalculator do
end end
GradeCalculator.new(@student.id, @course).compute_and_save_scores GradeCalculator.new(@student.id, @course).compute_and_save_scores
scored_enrollment_ids = Score.where(assignment_group_id: @group1.id).map(&:enrollment_id) scored_enrollment_ids = Score.where(assignment_group_id: @group1.id).map(&:enrollment_id)
expect(scored_enrollment_ids).to contain_exactly(*(@student.enrollments.map(&:id))) expect(scored_enrollment_ids).to contain_exactly(*@student.enrollments.map(&:id))
end end
it "creates a course score for the student if one does not exist, but assignment group scores exist" do it "creates a course score for the student if one does not exist, but assignment group scores exist" do

View File

@ -47,7 +47,7 @@ describe "Gradebook - custom columns" do
expect(Gradebook.header_selector_by_col_index(2)).to include_text col.title expect(Gradebook.header_selector_by_col_index(2)).to include_text col.title
expect(Gradebook.slick_headers_selector.map(&:text).join).not_to include hidden.title expect(Gradebook.slick_headers_selector.map(&:text).join).not_to include hidden.title
expect((Gradebook.slick_custom_column_cell_selector).count { |c| c.text == "123456" }).to eq 1 expect(Gradebook.slick_custom_column_cell_selector.count { |c| c.text == "123456" }).to eq 1
end end
it "lets you show and hide the teacher notes column", priority: "1", test_id: 3253279 do it "lets you show and hide the teacher notes column", priority: "1", test_id: 3253279 do

View File

@ -236,8 +236,8 @@ module GroupsCommon
end end
def select_change_groups_option def select_change_groups_option
(ff('#option_change_groups').last).click ff('#option_change_groups').last.click
(ff('#clone_category_submit_button').last).click ff('#clone_category_submit_button').last.click
wait_for_ajaximations wait_for_ajaximations
end end

View File

@ -40,7 +40,7 @@ module ManageGroupsCommon
replace_content form.find_element(:css, "#category_create_group_count"), opts[:group_count].to_s replace_content form.find_element(:css, "#category_create_group_count"), opts[:group_count].to_s
else else
form.find_element(:css, "#category_split_groups").click form.find_element(:css, "#category_split_groups").click
replace_content form.find_element(:css, "#category_split_group_count"), (opts[:group_count].to_s) replace_content form.find_element(:css, "#category_split_group_count"), opts[:group_count].to_s
end end
elsif enable_self_signup.attribute('checked') elsif enable_self_signup.attribute('checked')
form.find_element(:css, "#category_create_group_count").clear form.find_element(:css, "#category_create_group_count").clear

View File

@ -39,7 +39,7 @@ describe "outcomes" do
f('.submit_button').click f('.submit_button').click
wait_for_ajaximations wait_for_ajaximations
expect(f('.title').text).to include(title) expect(f('.title').text).to include(title)
expect((f('#calculation_int').text).to_i).to eq(value) expect(f('#calculation_int').text.to_i).to eq(value)
end end
context "create/edit/delete outcomes" do context "create/edit/delete outcomes" do

View File

@ -150,7 +150,7 @@ describe 'quizzes question creation' do
short_answer_field.call short_answer_field.call
driver.switch_to.alert driver.switch_to.alert
yield (driver.switch_to.alert) yield driver.switch_to.alert
accept_alert accept_alert
end end
end end

View File

@ -150,7 +150,7 @@ describe 'quizzes' do
(1..6).each do |var| (1..6).each do |var|
qs.submission_data[ qs.submission_data[
"question_#{question.id}_#{AssessmentQuestion.variable_id("answer#{var}")}" "question_#{question.id}_#{AssessmentQuestion.variable_id("answer#{var}")}"
] = ("this is my answer ##{var}") ] = "this is my answer ##{var}"
end end
response_array = qs.submission_data.values response_array = qs.submission_data.values
Quizzes::SubmissionGrader.new(qs).grade_submission Quizzes::SubmissionGrader.new(qs).grade_submission