2016-09-08 10:25:33 -05:00
|
|
|
# frozen_string_literal: true
|
2016-08-16 14:24:37 -05:00
|
|
|
require 'test_helper'
|
|
|
|
|
|
|
|
class CandidateQuizTest < ActiveSupport::TestCase
|
|
|
|
test "can get quiz question" do
|
|
|
|
fed8 = questions(:fed8)
|
|
|
|
|
|
|
|
quiz = CandidateQuiz.new candidates(:richard)
|
|
|
|
fetched = quiz.fetch_question(fed8.id)
|
|
|
|
|
|
|
|
assert_equal fed8.id, fetched.question_id
|
|
|
|
assert_equal fed8.question, fetched.question
|
|
|
|
end
|
|
|
|
|
|
|
|
test "can build full quiz" do
|
|
|
|
quiz = CandidateQuiz.new(candidates(:richard)).build_my_quiz
|
|
|
|
|
|
|
|
assert_equal questions(:fed1).question, quiz.first.question
|
|
|
|
assert_equal answers(:richard10).answer, quiz[9].answer
|
|
|
|
end
|
|
|
|
end
|