Commit d594dae4 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Move include to prepended block to fix emails

Due to some magical interaction between ActiveSupport::Concern and
ActionMailer::Base, we'll need to move them into the prepended block,
otherwise those email methods cannot be properly promoted as class
methods for Notify.
parent 9c389410
...@@ -3,10 +3,15 @@ module EE ...@@ -3,10 +3,15 @@ module EE
extend ActiveSupport::Concern extend ActiveSupport::Concern
extend ::Gitlab::Utils::Override extend ::Gitlab::Utils::Override
include ::Emails::AdminNotification # We need to put includes in prepended block due to the magical
include ::Emails::CsvExport # interaction between ActiveSupport::Concern and ActionMailer::Base
include ::Emails::ServiceDesk # See https://gitlab.com/gitlab-org/gitlab-ee/issues/7846
include ::Emails::Epics prepended do
include ::Emails::AdminNotification
include ::Emails::CsvExport
include ::Emails::ServiceDesk
include ::Emails::Epics
end
attr_reader :group attr_reader :group
......
# frozen_string_literal: true
require 'spec_helper'
describe Emails::AdminNotification do
it 'adds email methods to Notify' do
subject.instance_methods.each do |email_method|
expect(Notify).to be_respond_to(email_method)
end
end
end
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
require 'email_spec' require 'email_spec'
...@@ -5,6 +7,12 @@ describe Emails::CsvExport do ...@@ -5,6 +7,12 @@ describe Emails::CsvExport do
include EmailSpec::Matchers include EmailSpec::Matchers
include_context 'gitlab email notification' include_context 'gitlab email notification'
it 'adds email methods to Notify' do
subject.instance_methods.each do |email_method|
expect(Notify).to be_respond_to(email_method)
end
end
describe 'csv export email' do describe 'csv export email' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:empty_project) { create(:project, path: 'myproject') } let(:empty_project) { create(:project, path: 'myproject') }
......
# frozen_string_literal: true
require 'spec_helper'
describe Emails::Epics do
it 'adds email methods to Notify' do
subject.instance_methods.each do |email_method|
expect(Notify).to be_respond_to(email_method)
end
end
end
# frozen_string_literal: true
require 'spec_helper'
describe Emails::ServiceDesk do
it 'adds email methods to Notify' do
subject.instance_methods.each do |email_method|
expect(Notify).to be_respond_to(email_method)
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment