worker tests

This commit is contained in:
Mark Moser 2016-08-16 14:19:45 -05:00
parent de7ce04615
commit f44b11fde8
3 changed files with 17 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -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