don't search deleted questions for broken links
closes #ADMIN-700 Change-Id: If85d72013be018c4259ea23ebfae4121dbcb7b29 Reviewed-on: https://gerrit.instructure.com/138584 Tested-by: Jenkins Reviewed-by: Jeremy Stanley <jeremy@instructure.com> Product-Review: James Williams <jamesw@instructure.com> QA-Review: James Williams <jamesw@instructure.com>
This commit is contained in:
parent
2ef527ecef
commit
e3aa711ea5
|
@ -117,7 +117,7 @@ class CourseLinkValidator
|
|||
self.issues << {:name => quiz.title, :type => :quiz,
|
||||
:content_url => "/courses/#{self.course.id}/quizzes/#{quiz.id}"}.merge(:invalid_links => links)
|
||||
end
|
||||
quiz.quiz_questions.each do |qq|
|
||||
quiz.quiz_questions.active.each do |qq|
|
||||
check_question(qq)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -104,6 +104,23 @@ describe CourseLinkValidator do
|
|||
expect(issues).to be_empty
|
||||
end
|
||||
|
||||
it "should not run on deleted quiz questions" do
|
||||
allow_any_instance_of(CourseLinkValidator).to receive(:reachable_url?).and_return(false) # don't actually ping the links for the specs
|
||||
html = %{<a href='http://www.notarealsitebutitdoesntmattercauseimstubbingitanwyay.com'>linky</a>}
|
||||
|
||||
course_factory
|
||||
quiz = @course.quizzes.create!(:title => 'quiz1', :description => "desc")
|
||||
qq = quiz.quiz_questions.create!(:question_data => {'name' => 'test question',
|
||||
'question_text' => html, 'answers' => [{'id' => 1}, {'id' => 2}]})
|
||||
qq.destroy!
|
||||
|
||||
CourseLinkValidator.queue_course(@course)
|
||||
run_jobs
|
||||
|
||||
issues = CourseLinkValidator.current_progress(@course).results[:issues]
|
||||
expect(issues.count).to eq 0
|
||||
end
|
||||
|
||||
it "should not care if it can reach it" do
|
||||
allow_any_instance_of(CourseLinkValidator).to receive(:reachable_url?).and_return(true)
|
||||
|
||||
|
|
Loading…
Reference in New Issue