<commit_before>require "spec_helper"

describe Devise::Mailer do
  let(:user) { mock_model(User, email: "<EMAIL>", name: "Matthew") }
  describe "#confirmation_instructions" do
    let(:mail) { Devise::Mailer.confirmation_instructions(user, "abc<PASSWORD>") }

    it { expect(mail.from).to eq ["<EMAIL>"] }
    it { expect(mail.to).to eq ["<EMAIL>"] }
    it { expect(mail.subject).to eq "How to confirm your account" }
    it { expect(mail).to_not be_multipart }
    it do
      expect(mail.body.to_s).to eq <<-EOF
<p>Congratulations Matthew!</p>
<p>
You are one step away from creating your account on
They Vote For You
</p>
<p>Please confirm your account email by clicking the link below:</p>
<p><a href="http://pw.org.au/users/confirmation?confirmation_token=<PASSWORD>">Confirm my account</a></p>
      EOF
    end
  end

  describe "#reset_password_instructions" do
    let(:mail) { Devise::Mailer.reset_password_instructions(user, "<PASSWORD>") }

    it { expect(mail.from).to eq ["<EMAIL>"] }
    it { expect(mail.to).to eq ["<EMAIL>"] }
    it { expect(mail.subject).to eq "Reset your password" }
    it { expect(mail).to_not be_multipart }
    it do
      expect(mail.body.to_s).to eq <<-EOF<commit_msg>Test name used in from<commit_after>require "spec_helper"

describe Devise::Mailer do
  let(:user) { mock_model(User, email: "<EMAIL>", name: "Matthew") }
  describe "#confirmation_instructions" do
    let(:mail) { Devise::Mailer.confirmation_instructions(user, "abc<PASSWORD>") }

    it { expect(mail.from).to eq ["<EMAIL>"] }
    it { expect(mail[:from].display_names).to eq ["They Vote For You"]}
    it { expect(mail.to).to eq ["<EMAIL>"] }
    it { expect(mail.subject).to eq "How to confirm your account" }
    it { expect(mail).to_not be_multipart }
    it do
      expect(mail.body.to_s).to eq <<-EOF
<p>Congratulations Matthew!</p>
<p>
You are one step away from creating your account on
They Vote For You
</p>
<p>Please confirm your account email by clicking the link below:</p>
<p><a href="http://pw.org.au/users/confirmation?confirmation_token=<PASSWORD>">Confirm my account</a></p>
      EOF
    end
  end

  describe "#reset_password_instructions" do
    let(:mail) { Devise::Mailer.reset_password_instructions(user, "<PASSWORD>") }

    it { expect(mail.from).to eq ["<EMAIL>"] }
    it { expect(mail[:from].display_names).to eq ["They Vote For You"]}
    it { expect(mail.to).to eq ["<EMAIL>"] }
    it { expect(mail.subject).to eq "Reset your password" }
    it { expect(mail).to_not be_multipart }
    it do
      expect(mail.body.to_s).to eq <<-EOF
{'fraction_non_alphanumeric': 0.15795586527293845, 'fraction_numerical': 0.0, 'mean_word_length': 3.998065764023211, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2743208', 'n_tokens_mistral': 899, 'n_tokens_neox': 880, 'n_words': 225}