diff options
Diffstat (limited to 'spec/mailers/notify_spec.rb')
-rw-r--r-- | spec/mailers/notify_spec.rb | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb index 5733e892d2a..684fe9bb9cf 100644 --- a/spec/mailers/notify_spec.rb +++ b/spec/mailers/notify_spec.rb @@ -419,15 +419,15 @@ RSpec.describe Notify do end it 'includes the reason in the footer' do - text = EmailsHelper.instance_method(:notification_reason_text).bind(self).call(reason: NotificationReason::ASSIGNED, format: :html) + text = EmailsHelper.instance_method(:notification_reason_text).bind_call(self, reason: NotificationReason::ASSIGNED, format: :html) is_expected.to have_body_text(text) new_subject = described_class.reassigned_merge_request_email(recipient.id, merge_request.id, [previous_assignee.id], current_user.id, NotificationReason::MENTIONED) - text = EmailsHelper.instance_method(:notification_reason_text).bind(self).call(reason: NotificationReason::MENTIONED, format: :html) + text = EmailsHelper.instance_method(:notification_reason_text).bind_call(self, reason: NotificationReason::MENTIONED, format: :html) expect(new_subject).to have_body_text(text) new_subject = described_class.reassigned_merge_request_email(recipient.id, merge_request.id, [previous_assignee.id], current_user.id, nil) - text = EmailsHelper.instance_method(:notification_reason_text).bind(self).call(format: :html) + text = EmailsHelper.instance_method(:notification_reason_text).bind_call(self, format: :html) expect(new_subject).to have_body_text(text) end end @@ -649,16 +649,20 @@ RSpec.describe Notify do end context 'the model has no namespace' do - class TopLevelThing - include Referable - include Noteable + before do + stub_const('TopLevelThing', Class.new) - def to_reference(*_args) - 'tlt-ref' - end + TopLevelThing.class_eval do + include Referable + include Noteable - def id - 'tlt-id' + def to_reference(*_args) + 'tlt-ref' + end + + def id + 'tlt-id' + end end end @@ -672,8 +676,10 @@ RSpec.describe Notify do end context 'the model has a namespace' do - module Namespaced - class Thing + before do + stub_const('Namespaced::Thing', Class.new) + + Namespaced::Thing.class_eval do include Referable include Noteable |