canvas-lms/spec/models/courses
Simon Williams 7cb47a1d0e fix delayed alerts for courses with only section-limited teachers
fixes CNVS-16376

test plan:
- enable account alerts in account settings
- enroll a teacher in a course as section limited (they should be the only
  teacher)
- make sure the teacher has a verified email address
- visit the teacher's notification preferences page to make sure there is
  a notification policy set up for the alert notification.  confusingly, this
  is not the same as the "Alert" section on the page, this notification policy
  actually cannot be customized, but visiting the page will create it if it
  doesn't already exist.
- the annoying thing about this alert notification policy is setup is that it
  is set up to be a 'daily' policy, and it can't be customized.  this means
  that even after the job runs and creates the message successfully, it won't
  actually be sent until the following daily batch. to fix this for testing,
  you can make the notification policy immediate by running the following in
  a rails console:
    ```
    NotificationPolicy.
      where(:notification_id => Notification.by_name("Alert")).
      update_all(:frequency => "immediately")
    ```
- now set up an alert and trigger the conditions for the alert
- alert messages are only computed once per day at 11:30 utc. since this is
  an inconvenient time to have a patchset checked out, the easiest way to make
  this happen manually is to run the following in a rails conosle:
    `Alerts::DelayedAlertSender.process`
  however, be aware that this job sets a redis key after it runs to make sure
  notifications don't get sent twice to the same person, so if you do need to run
  it twice in one day for some reason, clear redis between runs.
- the alert message should be sent.  if you set up a real email address you
  should receive the message, or you can check that it was sent by using the
  "View Notifications" tab in the admin tools section of the account.

Change-Id: I3e7dc66975eb666bb498a995a5058d37b991fa91
Reviewed-on: https://gerrit.instructure.com/43138
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
QA-Review: Sean Lewis <slewis@instructure.com>
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
2014-10-30 16:07:12 +00:00
..
teacher_student_mapper_spec.rb fix delayed alerts for courses with only section-limited teachers 2014-10-30 16:07:12 +00:00