Skip to content

Commit c602928

Browse files
committed
Inherit Notification from parent class
1 parent 06628e1 commit c602928

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
### Unreleased
22

3+
* Inherit Notification from parent class Notification.
34
* Support callbacks in bulk delivery methods.
45

56
### 2.4.3

app/models/concerns/noticed/notification_methods.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module NotificationMethods
66
# Generate a Notification class each time a Notifier is defined
77
def inherited(notifier)
88
super
9-
notifier.const_set :Notification, Class.new(Noticed::Notification)
9+
notifier.const_set :Notification, Class.new(self.const_defined?(:Notification) ? const_get(:Notification) : Noticed::Notification)
1010
end
1111

1212
def notification_methods(&block)
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
class ApplicationNotifier < Noticed::Event
2+
notification_methods do
3+
def inherited_method
4+
end
5+
end
26
end

test/notifier_test.rb

+4
Original file line numberDiff line numberDiff line change
@@ -232,4 +232,8 @@ class RecipientsLambdaEphemeral < Noticed::Ephemeral
232232
end
233233
end
234234
end
235+
236+
test "inherits notification_methods from application notifier" do
237+
assert SimpleNotifier::Notification.new.respond_to?(:inherited_method)
238+
end
235239
end

0 commit comments

Comments
 (0)