-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add target and notifier module tests
- Loading branch information
Showing
12 changed files
with
643 additions
and
29 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
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,23 @@ | ||
shared_examples_for :notifier do | ||
let(:test_class_name) { described_class.to_s.underscore.split('/').last.to_sym } | ||
let(:test_instance) { create(test_class_name) } | ||
|
||
describe "with association" do | ||
it "has many sent_notifications" do | ||
notification_1 = create(:notification, notifier: test_instance) | ||
notification_2 = create(:notification, notifier: test_instance) | ||
expect(test_instance.sent_notifications.count).to eq(2) | ||
expect(test_instance.sent_notifications.earliest).to eq(notification_1) | ||
expect(test_instance.sent_notifications.latest).to eq(notification_2) | ||
end | ||
end | ||
|
||
describe "as public class methods" do | ||
describe "available_as_notifier?" do | ||
it "returns true" do | ||
expect(described_class.available_as_notifier?).to be_truthy | ||
end | ||
end | ||
end | ||
|
||
end |
Oops, something went wrong.