worker tests
This commit is contained in:
parent
de7ce04615
commit
f44b11fde8
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user