docbrown/spec/mailers/verification_mailer_spec.rb
Mac Siri 842e6880b8
Routine rubocop fix on /spec (#19217)
* Softrun rubocop

* Hardrun rubocop (-A)

* Change a rubocop rule

* Add missing cops

* Undo & redo rubocop -A
2023-03-21 09:55:26 -04:00

23 lines
842 B
Ruby

require "rails_helper"
RSpec.describe VerificationMailer do
let(:user) { create(:user) }
let(:from_email_address) { "custom_noreply@forem.com" }
describe "#account_ownership_verification_email" do
before do
allow(Settings::SMTP).to receive(:provided_minimum_settings?).and_return(true)
allow(Settings::SMTP).to receive(:from_email_address).and_return(from_email_address)
end
it "works correctly", :aggregate_failures do
email = described_class.with(user_id: user.id).account_ownership_verification_email
expect(email.subject).not_to be_nil
expect(email.to).to eq([user.email])
expect(email.from).to eq([from_email_address])
from = "#{Settings::Community.community_name} Email Verification <#{from_email_address}>"
expect(email["from"].value).to eq(from)
end
end
end