rethinking question CRUD
This commit is contained in:
54
test/controllers/candidate_controller_test.rb
Normal file
54
test/controllers/candidate_controller_test.rb
Normal file
@ -0,0 +1,54 @@
|
||||
require 'test_helper'
|
||||
|
||||
class CandidateControllerTest < ActionDispatch::IntegrationTest
|
||||
def setup_auth candidate
|
||||
post validate_candidate_url, params: { test_id: candidate.test_hash }
|
||||
end
|
||||
|
||||
test "should get login" do
|
||||
get welcome_path
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should require auth or redirect" do
|
||||
get saved_path
|
||||
assert_redirected_to welcome_path
|
||||
|
||||
get thankyou_path
|
||||
assert_redirected_to welcome_path
|
||||
|
||||
get summary_path
|
||||
assert_redirected_to welcome_path
|
||||
|
||||
get question_path
|
||||
assert_redirected_to welcome_path
|
||||
|
||||
get question_path(questions(:fed1).id)
|
||||
assert_redirected_to welcome_path
|
||||
|
||||
get live_coder_path(questions(:fed1).id)
|
||||
assert_redirected_to welcome_path
|
||||
end
|
||||
|
||||
test "should auth to question" do
|
||||
setup_auth candidates(:martha)
|
||||
|
||||
assert_redirected_to question_path
|
||||
assert session[:test_id].present?
|
||||
end
|
||||
|
||||
test "should redirect to thankyou when completed" do
|
||||
setup_auth candidates(:richard)
|
||||
|
||||
assert_redirected_to thankyou_path
|
||||
end
|
||||
|
||||
test "should get summary if complete but not submitted" do
|
||||
setup_auth candidates(:dawn)
|
||||
|
||||
get summary_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
# should get flash message on bad question
|
||||
end
|
Reference in New Issue
Block a user