move summary and questions to quiz controller
This commit is contained in:
@ -17,15 +17,6 @@ class CandidateControllerTest < ActionDispatch::IntegrationTest
|
||||
|
||||
get thankyou_path
|
||||
assert_redirected_to login_path
|
||||
|
||||
get summary_path
|
||||
assert_redirected_to login_path
|
||||
|
||||
get question_path
|
||||
assert_redirected_to login_path
|
||||
|
||||
get question_path(questions(:fed1).id)
|
||||
assert_redirected_to login_path
|
||||
end
|
||||
|
||||
test "should auth to welcome" do
|
||||
@ -71,16 +62,6 @@ class CandidateControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get flash message on bad radio response" do
|
||||
setup_auth candidates(:martha)
|
||||
qid = questions(:fed1).id
|
||||
post post_answer_path, params: { answer: { question_id: qid, radio: nil } }
|
||||
|
||||
assert_response :success
|
||||
assert session[:test_id].present?
|
||||
assert_equal qid, flash[:answer_error]
|
||||
end
|
||||
|
||||
test "should NOT send mailers on submission" do
|
||||
setup_auth candidates(:dawn)
|
||||
|
||||
|
28
test/controllers/quiz_controller_test.rb
Normal file
28
test/controllers/quiz_controller_test.rb
Normal file
@ -0,0 +1,28 @@
|
||||
require 'test_helper'
|
||||
|
||||
class QuizControllerTest < ActionDispatch::IntegrationTest
|
||||
def setup_auth candidate
|
||||
post validate_candidate_url, params: { test_id: candidate.test_hash }
|
||||
end
|
||||
|
||||
test "should require auth and redirect" do
|
||||
get summary_path
|
||||
assert_redirected_to login_path
|
||||
|
||||
get question_path
|
||||
assert_redirected_to login_path
|
||||
|
||||
get question_path(questions(:fed1).id)
|
||||
assert_redirected_to login_path
|
||||
end
|
||||
|
||||
test "should get flash message on bad radio response" do
|
||||
setup_auth candidates(:martha)
|
||||
qid = questions(:fed1).id
|
||||
post post_answer_path, params: { answer: { question_id: qid, radio: nil } }
|
||||
|
||||
assert_response :success
|
||||
assert session[:test_id].present?
|
||||
assert_equal qid, flash[:answer_error]
|
||||
end
|
||||
end
|
@ -1,6 +1,6 @@
|
||||
require 'test_helper'
|
||||
|
||||
class QuestionFeatureTest < ActionDispatch::IntegrationTest
|
||||
class QuestionAttachmentsTest < ActionDispatch::IntegrationTest
|
||||
def setup_auth candidate
|
||||
post validate_candidate_url, params: { test_id: candidate.test_hash }
|
||||
end
|
18
test/integration/question_live_coder_test.rb
Normal file
18
test/integration/question_live_coder_test.rb
Normal file
@ -0,0 +1,18 @@
|
||||
require 'test_helper'
|
||||
|
||||
class QuestionLiveCoderTest < ActionDispatch::IntegrationTest
|
||||
def setup_auth candidate
|
||||
post validate_candidate_url, params: { test_id: candidate.test_hash }
|
||||
end
|
||||
|
||||
test "can load a live coder question" do
|
||||
setup_auth candidates(:dawn)
|
||||
question = questions(:fed7)
|
||||
|
||||
get question_path(question.id)
|
||||
assert_response :success
|
||||
assert_select '.question-text', question.question
|
||||
# TODO: add in capybara and test form post
|
||||
# assert_redirected summary_path
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user