21 lines
564 B
Ruby
21 lines
564 B
Ruby
|
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
|