From 8e27fb8e015081807abbaa17782de7038cc19de3 Mon Sep 17 00:00:00 2001 From: Mark Moser Date: Tue, 2 Aug 2016 11:57:52 -0500 Subject: [PATCH] mailers on submission --- app/controllers/candidate_controller.rb | 5 +++++ test/controllers/candidate_controller_test.rb | 8 ++++++++ 2 files changed, 13 insertions(+) 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