You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: mailer_helper.rb
    path of file: ./repos/identity-idp/spec/support
    
    the code of the file until where you have to start completion: module MailerHelper
  def last_email
    ActionMailer::Base.deliveries.last
  end

  def reset_email
    ActionMailer::Base.d
    
  def expect_delivered_email(to: nil, subject: nil, body: nil)
    email = ActionMailer::Base.deliveries.find do |sent_mail|
      next unless to.present? && sent_mail.to == to
      next unless subject.present? && sent_mail.subject == subject
      if body.present?
        delivered_body = sent_mail.text_part.decoded.squish
        body.to_a.each do |expected_body|
          next unless delivered_body.include?(expected_body)
        end
      end
      true
    end