diff --git a/app/models/candidate.rb b/app/models/candidate.rb index 7da2524..f4dfc84 100644 --- a/app/models/candidate.rb +++ b/app/models/candidate.rb @@ -22,7 +22,7 @@ class Candidate < ApplicationRecord end def fetch_question qid - CandidateQuiz.new(id).fetch_question(qid).first + CandidateQuiz.new(id).fetch_question(qid) end def my_quiz diff --git a/app/workers/candidate_quiz.rb b/app/workers/candidate_quiz.rb index 6b7b738..bedc7a9 100644 --- a/app/workers/candidate_quiz.rb +++ b/app/workers/candidate_quiz.rb @@ -6,7 +6,8 @@ class CandidateQuiz end def fetch_question qid - raw_quiz(qid).each_with_object([]) { |row, quiz| quiz << CandidateQuizQuestion.new(row) } + questions = raw_quiz(qid).each_with_object([]) { |row, quiz| quiz << CandidateQuizQuestion.new(row) } + questions.first end def build_my_quiz diff --git a/test/workers/quiz_status_test.rb b/test/workers/quiz_status_test.rb index ed69e1b..615eac7 100644 --- a/test/workers/quiz_status_test.rb +++ b/test/workers/quiz_status_test.rb @@ -98,4 +98,18 @@ class QuizStatusTest < ActiveSupport::TestCase assert_equal nil, status.current_question_id end + + test "richard has no_finish_laters" do + richard = candidates :richard + status = QuizStatus.new richard + + assert status.no_finish_later + end + + test "juan has some finish_laters" do + juan = candidates :juan + status = QuizStatus.new juan + + refute status.no_finish_later + end end