FIX: don't send repeated notifications that there are pending users who need to be approved to moderators who haven't read the previous notification

This commit is contained in:
Neil Lalonde
2014-07-16 17:53:44 -04:00
parent d9c2b316b6
commit 4c867c5796
3 changed files with 28 additions and 5 deletions

View File

@@ -9,13 +9,15 @@ describe Jobs::PendingUsersReminder do
it "doesn't send a message to anyone when there are no pending users" do
AdminUserIndexQuery.any_instance.stubs(:find_users_query).returns(stub_everything(count: 0))
GroupMessage.any_instance.expects(:create).never
PostCreator.expects(:create).never
Jobs::PendingUsersReminder.new.execute({})
end
it "sends a message to moderators when there are pending users" do
it "sends a message when there are pending users" do
Fabricate(:moderator)
Group.refresh_automatic_group!(:moderators)
AdminUserIndexQuery.any_instance.stubs(:find_users_query).returns(stub_everything(count: 1))
GroupMessage.expects(:create).with(Group[:moderators].name, :pending_users_reminder, anything)
PostCreator.expects(:create).once
Jobs::PendingUsersReminder.new.execute({})
end
end
@@ -27,7 +29,7 @@ describe Jobs::PendingUsersReminder do
it "doesn't send a message to anyone when there are pending users" do
AdminUserIndexQuery.any_instance.stubs(:find_users_query).returns(stub_everything(count: 1))
GroupMessage.any_instance.expects(:create).never
PostCreator.expects(:create).never
Jobs::PendingUsersReminder.new.execute({})
end
end