-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
retain the default listeners for future unsubscribing
subscribe the hyrax default listeners in batch. provide a hook for looking up the `Hyrax.publisher.default_listeners`. this makes it possible to unsubscribe individual listeners at a later time. these instances have to live in memory for the life of the Publisher anyway, so this shouldn't impact when they are freed for garbage collection.
- Loading branch information
tamsin johnson
committed
Aug 29, 2022
1 parent
27d62a2
commit 141d96d
Showing
3 changed files
with
36 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# frozen_string_literal: true | ||
|
||
RSpec.describe Hyrax::Publisher do | ||
subject(:publisher) { described_class.instance } # singleton instance | ||
|
||
describe "#default_listeners" do | ||
it "returns a collection of listeners" do | ||
# listeners can be any Object, so we can't verify they are valid here | ||
expect(publisher.default_listeners).to be_a Enumerable | ||
end | ||
|
||
it "returns the same collection on successive calls" do | ||
expect(publisher.default_listeners).to eql publisher.default_listeners | ||
end | ||
end | ||
end |