2022-11-02 21:41:30 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-03-17 21:24:38 +08:00
|
|
|
describe Jobs::Chat::EmailNotifications do
|
2022-11-02 21:41:30 +08:00
|
|
|
before { Jobs.run_immediately! }
|
|
|
|
|
|
|
|
context "when chat is enabled" do
|
|
|
|
before { SiteSetting.chat_enabled = true }
|
|
|
|
|
|
|
|
it "starts the mailer" do
|
2023-03-17 21:24:38 +08:00
|
|
|
Chat::Mailer.expects(:send_unread_mentions_summary)
|
2022-11-02 21:41:30 +08:00
|
|
|
|
2023-03-17 21:24:38 +08:00
|
|
|
Jobs.enqueue(Jobs::Chat::EmailNotifications)
|
2022-11-02 21:41:30 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context "when chat is not enabled" do
|
2022-12-14 08:25:19 +08:00
|
|
|
before { SiteSetting.chat_enabled = false }
|
|
|
|
|
2022-11-02 21:41:30 +08:00
|
|
|
it "does nothing" do
|
2023-03-17 21:24:38 +08:00
|
|
|
Chat::Mailer.expects(:send_unread_mentions_summary).never
|
2022-11-02 21:41:30 +08:00
|
|
|
|
2023-03-17 21:24:38 +08:00
|
|
|
Jobs.enqueue(Jobs::Chat::EmailNotifications)
|
2022-11-02 21:41:30 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|