test suite refactor
This commit is contained in:
25
test/controllers/quiz_controller/get_question_test.rb
Normal file
25
test/controllers/quiz_controller/get_question_test.rb
Normal file
@ -0,0 +1,25 @@
|
||||
# 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
|
Reference in New Issue
Block a user