testing existance of instance var for views
This commit is contained in:
@ -38,6 +38,24 @@ class QuizControllerTest < ActionDispatch::IntegrationTest
|
||||
|
||||
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
|
||||
|
||||
test "should get summary" do
|
||||
setup_auth candidates :dawn
|
||||
get summary_path
|
||||
|
||||
assert_response :success
|
||||
assert assigns(:quiz), '@quiz not present'
|
||||
end
|
||||
|
||||
test "should redirect from summary" do
|
||||
setup_auth candidates :roy
|
||||
get summary_path
|
||||
|
||||
assert_redirected_to question_path
|
||||
end
|
||||
|
||||
test "should get flash message on bad radio response" do
|
||||
@ -48,6 +66,8 @@ class QuizControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_response :success
|
||||
assert session[:test_id].present?
|
||||
assert_equal qid, flash[:error]
|
||||
assert assigns(:question), '@question not present'
|
||||
assert assigns(:answer), '@answer not present'
|
||||
end
|
||||
|
||||
test "should get flash message on bad text response" do
|
||||
@ -58,6 +78,8 @@ class QuizControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_response :success
|
||||
assert session[:test_id].present?
|
||||
assert_equal qid, flash[:error]
|
||||
assert assigns(:question), '@question not present'
|
||||
assert assigns(:answer), '@answer not present'
|
||||
end
|
||||
|
||||
test "should process checkbox" do
|
||||
@ -67,6 +89,8 @@ class QuizControllerTest < ActionDispatch::IntegrationTest
|
||||
|
||||
assert_response :success
|
||||
assert session[:test_id].present?
|
||||
assert assigns(:question), '@question not present'
|
||||
assert assigns(:answer), '@answer not present'
|
||||
end
|
||||
|
||||
test 'should handle XHR update and complete progress' do
|
||||
@ -77,6 +101,8 @@ class QuizControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_response :success
|
||||
assert_match(/updated successfully/, JSON.parse(@response.body)['message'])
|
||||
assert_equal 100, JSON.parse(@response.body)['progress']
|
||||
assert assigns(:question), '@question not present'
|
||||
assert assigns(:answer), '@answer not present'
|
||||
end
|
||||
|
||||
test 'should handle XHR fail' do
|
||||
@ -86,5 +112,7 @@ class QuizControllerTest < ActionDispatch::IntegrationTest
|
||||
|
||||
assert_response 400
|
||||
assert_match(/select.*answer/i, JSON.parse(@response.body).join)
|
||||
assert assigns(:question), '@question not present'
|
||||
assert assigns(:answer), '@answer not present'
|
||||
end
|
||||
end
|
||||
|
@ -48,12 +48,14 @@ class RecruiterControllerTest < ActionDispatch::IntegrationTest
|
||||
setup_auth
|
||||
get recruiter_url
|
||||
assert_response :success
|
||||
assert assigns(:candidates), "@candidates not present"
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
setup_auth
|
||||
get new_candidate_url
|
||||
assert_response :success
|
||||
assert assigns(:candidate), "@candidate not present"
|
||||
end
|
||||
|
||||
test "should get create" do
|
||||
@ -85,6 +87,7 @@ class RecruiterControllerTest < ActionDispatch::IntegrationTest
|
||||
end
|
||||
end
|
||||
assert :success
|
||||
assert assigns(:candidate), "@candidate not present"
|
||||
assert_match(/failed.*save/i, flash[:error])
|
||||
end
|
||||
end
|
||||
|
@ -37,6 +37,7 @@ class ReviewControllerTest < ActionDispatch::IntegrationTest
|
||||
setup_auth
|
||||
get review_url
|
||||
assert_response :success
|
||||
assert assigns(:candidates), '@candidates not present'
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
@ -51,6 +52,9 @@ class ReviewControllerTest < ActionDispatch::IntegrationTest
|
||||
|
||||
get review_test_url(candidates(:richard).test_hash)
|
||||
assert_response :success
|
||||
assert assigns(:candidate), "@candidate not present"
|
||||
assert assigns(:quiz), "@quiz not present"
|
||||
assert assigns(:status), "@status not present"
|
||||
end
|
||||
|
||||
test 'should logout and reset session' do
|
||||
|
Reference in New Issue
Block a user