displays welcome back when test has started
This commit is contained in:
parent
1a97bb16fa
commit
a3eab2b27a
@ -14,6 +14,7 @@ class ApplicationController < ActionController::Base
|
||||
def current_candidate
|
||||
@current_candidate ||= Candidate.find_by(test_hash: session[:test_id]) if session[:test_id]
|
||||
end
|
||||
helper_method :current_candidate
|
||||
|
||||
private
|
||||
|
||||
|
@ -11,6 +11,7 @@ class CandidateController < ApplicationController
|
||||
end
|
||||
|
||||
def welcome
|
||||
render :welcome_back if current_candidate.answers.count > 0
|
||||
end
|
||||
|
||||
def saved
|
||||
|
16
app/views/candidate/welcome_back.html.erb
Normal file
16
app/views/candidate/welcome_back.html.erb
Normal file
@ -0,0 +1,16 @@
|
||||
<% content_for :title, "Skills Assessment" %>
|
||||
|
||||
<main class="intro_tpl">
|
||||
<h1 class="prft-heading">Welcome Back</h1>
|
||||
|
||||
<p>Hello <%= current_candidate.name %></p>
|
||||
|
||||
<p>
|
||||
We are ready to pick up where you left off.
|
||||
</p>
|
||||
|
||||
<div class="btn-return">
|
||||
<%= link_to "Return to Test", question_path, { class: "btn primary-btn" } %>
|
||||
</div>
|
||||
|
||||
</main>
|
@ -44,6 +44,20 @@ class CandidateControllerTest < ActionDispatch::IntegrationTest
|
||||
refute flash[:error].present?, "Should not be displaying an error message"
|
||||
end
|
||||
|
||||
test "should display welcome view" do
|
||||
setup_auth candidates(:martha)
|
||||
get welcome_path
|
||||
|
||||
assert_select '.prft-heading', "Welcome!"
|
||||
end
|
||||
|
||||
test "should display welcome back view" do
|
||||
setup_auth candidates(:roy)
|
||||
get welcome_path
|
||||
|
||||
assert_select '.prft-heading', "Welcome Back"
|
||||
end
|
||||
|
||||
test "should redirect to thankyou when completed" do
|
||||
setup_auth candidates(:richard)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user