module MailerHelpers

def clear_emails

def clear_emails
  ActionMailer::Base.deliveries.clear
end

def email_body(email)

def email_body(email)
  (email.try(:html_part).try(:body) || email.try(:body))&.encoded
end

def emails

def emails
  ActionMailer::Base.deliveries
end

def last_email

def last_email
  emails.last
end

def last_email_body

def last_email_body
  email_body(last_email)
end

def last_email_first_link

def last_email_first_link
  Nokogiri::HTML(last_email_body).css("table.content a").first["href"]
end

def last_email_link

def last_email_link
  Nokogiri::HTML(last_email_body).css("table.content a").last["href"]
end