don't run course link validator on questions in deleted banks
test plan: * create a question bank * create a question in the bank with an invalid link * the course link validator should find it * delete the question bank * the course link validator should not flag the link in the question anymore closes #CNVS-27389 Change-Id: Icab0298a071dc4c668ebbd0bfaab1e616e0c71af Reviewed-on: https://gerrit.instructure.com/72677 Tested-by: Jenkins Reviewed-by: Jeremy Stanley <jeremy@instructure.com> QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com> Product-Review: James Williams <jamesw@instructure.com>
This commit is contained in:
parent
5823cff3ce
commit
9de10e44ba
|
@ -52,6 +52,7 @@ class CourseLinkValidator
|
|||
|
||||
# Assessment questions
|
||||
self.course.assessment_questions.active.each do |aq|
|
||||
next if aq.assessment_question_bank.deleted?
|
||||
check_question(aq)
|
||||
end
|
||||
progress.update_completion! 15
|
||||
|
|
|
@ -80,6 +80,30 @@ describe CourseLinkValidator do
|
|||
|
||||
end
|
||||
|
||||
it "should not run on assessment questions in deleted banks" do
|
||||
CourseLinkValidator.any_instance.stubs(:reachable_url?).returns(false) # don't actually ping the links for the specs
|
||||
html = %{<a href='http://www.notarealsitebutitdoesntmattercauseimstubbingitanwyay.com'>linky</a>}
|
||||
|
||||
course
|
||||
bank = @course.assessment_question_banks.create!(:title => 'bank')
|
||||
aq = bank.assessment_questions.create!(:question_data => {'name' => 'test question',
|
||||
'question_text' => html, 'answers' => [{'id' => 1}, {'id' => 2}]})
|
||||
|
||||
CourseLinkValidator.queue_course(@course)
|
||||
run_jobs
|
||||
|
||||
issues = CourseLinkValidator.current_progress(@course).results[:issues]
|
||||
expect(issues.count).to eq 1
|
||||
|
||||
bank.destroy
|
||||
|
||||
CourseLinkValidator.queue_course(@course)
|
||||
run_jobs
|
||||
|
||||
issues = CourseLinkValidator.current_progress(@course).results[:issues]
|
||||
expect(issues).to be_empty
|
||||
end
|
||||
|
||||
it "should not care if it can reach it" do
|
||||
CourseLinkValidator.any_instance.stubs(:reachable_url?).returns(true)
|
||||
|
||||
|
|
Loading…
Reference in New Issue