skill-assessment-app/test/controllers/quiz_controller/get_question_test.rb

26 lines
802 B
Ruby
Raw Permalink Normal View History

2016-09-14 17:05:37 -05:00
# frozen_string_literal: true
require 'test_helper'
class QuizControllerTest < ActionDispatch::IntegrationTest
test "should require auth and redirect" do
get question_path
assert_redirected_to login_path
get question_path(questions(:fed1).id)
assert_redirected_to login_path
end
test "should redirect to next question on next" do
auth_candidate candidates(:roy)
qid = questions(:fed3).id
params = { submit: 'Next', answer: { question_id: qid, answer_hash: { text: 'stuff' } } }
post post_answer_path, params: params
assert_redirected_to question_path
assert session[:test_id].present?
assert assigns(:question), '@question not present'
assert assigns(:answer), '@answer not present'
assert assigns(:status), '@status not present'
end
end