diff --git a/app/controllers/candidate_controller.rb b/app/controllers/candidate_controller.rb index cb10cfe..2a271f8 100644 --- a/app/controllers/candidate_controller.rb +++ b/app/controllers/candidate_controller.rb @@ -41,6 +41,11 @@ class CandidateController < ApplicationController # TODO def update_summary # redirect_to :summary + + # only after successful submission + CandidateMailer.submitted(current_candidate).deliver_now + RecruiterMailer.candidate_submitted(current_candidate).deliver_now + ReviewerMailer.candidate_submission(current_candidate).deliver_now end def validate diff --git a/test/controllers/candidate_controller_test.rb b/test/controllers/candidate_controller_test.rb index cdc2989..c013fab 100644 --- a/test/controllers/candidate_controller_test.rb +++ b/test/controllers/candidate_controller_test.rb @@ -56,4 +56,12 @@ class CandidateControllerTest < ActionDispatch::IntegrationTest assert session[:test_id].present? assert_equal qid, flash[:answer_error] end + + test "should send mailers on submission" do + setup_auth candidates(:dawn) + + assert_difference("ActionMailer::Base.deliveries.size", 3) do + post post_summary_path + end + end end