mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-10-30 10:49:03 -04:00
- Subclass Devise::Mailer as DeviseMailer overriding subject_for to pass site_name option.
- Configure config.mailer = 'DeviseMailer' and config.mailer_sender in Devise initializer using GROWSTUFF_SITE_NAME env var.
- Update Devise locale subject strings in config/locales/devise.en.yml to use %{site_name}.
- Add spec/mailers/devise_mailer_spec.rb to verify subject interpolation.
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: Brenda Wallace <brenda@wallace.net.nz>
37 lines
1.2 KiB
Ruby
37 lines
1.2 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
RSpec.describe DeviseMailer, type: :mailer do
|
|
let(:member) { build(:member, email: 'user@example.com', login_name: 'testuser') }
|
|
|
|
before do
|
|
allow(ENV).to receive(:fetch).and_call_original
|
|
allow(ENV).to receive(:fetch).with('GROWSTUFF_SITE_NAME', 'Growstuff').and_return('Growstuff Staging')
|
|
end
|
|
|
|
describe '#confirmation_instructions' do
|
|
subject(:mail) { described_class.confirmation_instructions(member, 'token123') }
|
|
|
|
it 'includes the custom site name in the subject' do
|
|
expect(mail.subject).to eq('Welcome to Growstuff Staging. Please confirm your account.')
|
|
end
|
|
end
|
|
|
|
describe '#reset_password_instructions' do
|
|
subject(:mail) { described_class.reset_password_instructions(member, 'token123') }
|
|
|
|
it 'includes the custom site name in the subject' do
|
|
expect(mail.subject).to eq('Growstuff Staging password reset instructions')
|
|
end
|
|
end
|
|
|
|
describe '#unlock_instructions' do
|
|
subject(:mail) { described_class.unlock_instructions(member, 'token123') }
|
|
|
|
it 'includes the custom site name in the subject' do
|
|
expect(mail.subject).to eq('Unlock your Growstuff Staging account')
|
|
end
|
|
end
|
|
end
|