skill-assessment-app/test/workers/candidate_reminder_test.rb

28 lines
908 B
Ruby
Raw Permalink Normal View History

# frozen_string_literal: true
2016-08-02 15:25:55 -05:00
require 'test_helper'
2017-02-08 16:30:54 -06:00
class CandidateReminderTest < ActiveSupport::TestCase
2016-08-02 15:25:55 -05:00
test "collection is created with one result" do
2017-02-08 16:30:54 -06:00
reminders = CandidateReminder.new
2016-08-02 15:25:55 -05:00
assert_equal 1, reminders.size
end
test "each candidate has needed attributes" do
2017-02-08 16:30:54 -06:00
reminders = CandidateReminder.new
2016-08-02 15:25:55 -05:00
assert_instance_of String, reminders.candidates.first.name
assert_instance_of String, reminders.candidates.first.test_hash
assert_instance_of String, reminders.candidates.first.email
end
test "send reminders sends email, and flags reminded" do
2017-02-08 16:30:54 -06:00
reminders = CandidateReminder.new
2016-08-02 15:25:55 -05:00
pre_reminded = Candidate.find(reminders.candidates.first.id).reminded
assert_difference("ActionMailer::Base.deliveries.size", reminders.count) do
reminders.send_all
end
refute_equal pre_reminded, Candidate.find(reminders.candidates.first.id).reminded
end
end