spec: removal and shared specs and spec refactors

Change-Id: Iaed635190212ff75fed43ebbad3af3a3a791af33
Reviewed-on: https://gerrit.instructure.com/18964
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jake Sorce <jake@instructure.com>
Product-Review: Jake Sorce <jake@instructure.com>
QA-Review: Jake Sorce <jake@instructure.com>
paragem update enchanced failure log info and slow spec

Change-Id: I6ca008c2b054600a79473cfce4febf53034302d1
Reviewed-on: https://gerrit.instructure.com/19352
Reviewed-by: Jake Sorce <jake@instructure.com>
Product-Review: Jake Sorce <jake@instructure.com>
QA-Review: Jake Sorce <jake@instructure.com>
Tested-by: Jake Sorce <jake@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
US state and Canada province lists, refs #CNVS-4555

Change-Id: Iba533caa35b9e98918085e7a79bb2cedd55e35ed
Reviewed-on: https://gerrit.instructure.com/19067
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Joe Tanner <joe@instructure.com>
QA-Review: Joe Tanner <joe@instructure.com>
reduce min-width for quiz submissions in speedgrader

test plan:
  - as a teacher, view a quiz submission in the speedgrader
  - make sure the iframe with the quiz submission content isn't
    scrolling when your window is big enough, but is scrolling when
    your window gets smaller.

fixes CNVS-5053

Change-Id: Ib43025c223d92f5316147a322470f193b7c1d0ef
Reviewed-on: https://gerrit.instructure.com/19324
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bryan Madsen <bryan@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
passes the requestor's state through when it is provided

Change-Id: I55c7f3b3608ebd68323b73637c612e170f5130b8
Reviewed-on: https://gerrit.instructure.com/19047
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Product-Review: Brad Humphrey <brad@instructure.com>
don't delete group discussion when editing

fixes CNVS-5052

test plan, in three parts

part one, wherein group discussions are not deleted
- create a Group Assignment discussion
- edit the discussion from the group's context. ie, your url should
 be /groups/:group_id/discussion_topics/:discussion_id/edit
- save the edited discussion
- ensure that the discussion has not been deleted

part two, wherein an announcement is not an assignment
- create an announcement with an attachment
- edit an announcement with an attachment
- ensure that announcements at no point become assignments

part three, wherein discussions are no longer assignments
- create a discussion for grading
- edit the discussion, making it not for grading
- ensure that the setting sticks so that the discussion is no
 longer an assignment

Change-Id: I4214d756ffa794081a2cff987cee625bb4cee4eb
Reviewed-on: https://gerrit.instructure.com/19309
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
context modules drag-and-drop keyboard accessibility

comparable to the course navigation ui (CNVS-288)

test plan:
* on the course modules page:
 * read hidden instructions at top of navigation tab
 * In Jaws: Use Insert-Z to turn virtal cursor off
 * use the tab key to focus on one of the modules
 or module items
 * use up/down arrow keys to change focus between items
 * use spacebar to start dragging the module/item
 * use up/down again to move around
 * use spacebar again to drop it after the currently
   focused module/item

fixes #CNVS-4944

Change-Id: Ie8e2e7dbca5268718d1802ab01602cd6f6d4218d
Reviewed-on: https://gerrit.instructure.com/19293
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
Product-Review: Dana Morley <dana@instructure.com>
account-level password policy support, fixes CNVS-4211

test plan:
1. set up a new password policy via the console, e.g.
   a = Account.default
   a.settings[:password_policy] = {:min_length=>6, :max_sequence=>3, :max_repeats=>3, :disallow_common_passwords=>true}
   a.save!
2. go to /register and sign up as a student
3. make sure the password policy is enforced, i.e.
   1. confirm that the password must be at least 6 chars
   2. confirm that the password cannot be a common one (e.g. football)
   3. confirm that the password cannot contain a run of 4 or more chars
      (e.g. abc123lol is ok, abcd1234 is not)
   4. confirm that the password cannot have the same char repeated 4 or
      more times (e.g. aaa000bb is ok aaaabbbb is not)
4. verify the password policy is enforced when changing your password as
   an existing user (via user profile/settings)
5. verify the password policy is enforced when adding a login for a user
6. verify the password policy is enforced when resetting your password
   (via forgot password on login page)
7. invite a new user into a course, and as that user verify the password
   policy is enforced when you set up your account

Change-Id: Ie619fc255dc940249676bf5e510ce68eaf17441c
Reviewed-on: https://gerrit.instructure.com/19104
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
Tested-by: Jon Jensen <jon@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
speed up scheduler

fixes CNVS-4561

removed some duplicate work
memoized a couple of methods
now bails early when there are no slots signed up for
added a couple of indices

test plan
- make sure scheduler works the same as it used to

Change-Id: I9bea3daa5706eb5dba83d8112ea2ef8229ca0e0e
Reviewed-on: https://gerrit.instructure.com/19192
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
allow elementToggler to manage multiple elements.

test plan:
  * run javascript specs;
  * on new discussion page, check the "Delay posting"
    checkbox and ensure that it still shows/hides its
    associated textbox.

Change-Id: Ie2f25d66795a25feeab01533c95bf111f2a39323
Reviewed-on: https://gerrit.instructure.com/18704
Reviewed-by: Eric Berry <ericb@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
upgrade pg gem to latest

>= 0.11.0 passes all params on to libpq, so need to restrict our initializer
to restrict the params from database.yml to avoid errors

Change-Id: Ie7cab5163a960b05eb3feb4c8487f0a1a36ae4a1
Reviewed-on: https://gerrit.instructure.com/19370
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
insert form errors text into an aria-live div

fixes CNVS-4920

This will cause screen readers to read the text of the error alert out
loud, even when the tooltip isn't on the currently selected form field. I
have to insert the div into the application layout, because VoiceOver
doesn't read the alert if you create the div after the page
is loaded.

test plan: with various screen readers, go to the canvas login screen.
leave your username and/or password blank and submit the form. you
should hear the "Invalid login" or "Invalid password" alert read
aloud.

Change-Id: If8cad4759f68716998c1c6d7cb2862d22e5b159c
Reviewed-on: https://gerrit.instructure.com/19227
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
Revert "spec: removal and shared specs and spec refactors"

This reverts commit 9c05b5171462b74bea5277993f1a00745267a851

Change-Id: Ia8250ef9d71cf70f0bc02208f2f459ed72c239e5
Reviewed-on: https://gerrit.instructure.com/19408
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Tested-by: Bryan Madsen <bryan@instructure.com>
context_user_name: don't reload users

also pruned out some unused options and other silliness

fixes CNVS-5150

Test plan:
  make sure pages that use context_user_name like discussions still work

Change-Id: I494f3fed067af632da246ed7d3add0d9e858517c
Reviewed-on: https://gerrit.instructure.com/18772
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
When restoring a discussion topic, restore its child topics

fixes CNVS-4954

test plan:
 - create a group discussion topic assignment
 - delete the group discussion topic
 - go to /courses/:id/undelete and restore the topic
 - go back to the topic and verify the linked child topics were
   also restored.

Change-Id: Ia01ce855ff92110c3fb6b227234a42ba8edad5bf
Reviewed-on: https://gerrit.instructure.com/19285
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
Product-Review: Jon Willesen <jonw@instructure.com>
add support for payment url during self enrollment, refs CNVS-4928

refactor self enrollment flow to support a @confirm_enrollment_url (can be
set via plugin). if set, the user will be created/authenticated, but
rather than being enrolled, s?he will be redirected to this url (for
payment, lo que sea).

NOTE: it's incumbent upon the plugin author to also add any necessary
checks to the self_enrollment code so that users can't just hit the API
directly and circumvent required payment steps.

test plan:

there are no functional changes in this commit, we just need to do a basic
regression test, i.e.

1. confirm you can self enroll as a new user
2. confirm you can self enroll as an existing unauthenticated user
3. confirm you can self enroll as an existing authenticated user

additionally, we should confirm that the various error scenarios work
(i.e. make sure you have to enter in all required fields).

Change-Id: Ic51d82114e08c5f3700d1b567643405b48cb7d4f
Reviewed-on: https://gerrit.instructure.com/19028
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
Reviewed-by: Joe Tanner <joe@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
implemented dress_code

also added styles to make .form-controls look
good in dialogs.

closes #CNVS-4302

Change-Id: Ibe54ee4046ac255b0b0ea83d32afc88e4a820464
Reviewed-on: https://gerrit.instructure.com/19331
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
QA-Review: Ryan Florence <ryanf@instructure.com>
Product-Review: Ryan Florence <ryanf@instructure.com>
make quiz_statistics model

refs CNVS-4887

This probably should have happened anyway, but the intermediate model
will be necessary to handle attachments for the downloadable
quiz_statistics.csv

Test plan:
  * make sure the quiz statistics page still works
  * make sure downloading quiz statistics csv still works

Change-Id: I9562a731d171dae24329fc52782a4f9efa4cf8bd
Reviewed-on: https://gerrit.instructure.com/18977
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
update para exclude rake tasks to use parallelized runtime

Change-Id: Idf7b1abbccc83800bc3582e8713641c7a8b71139
Reviewed-on: https://gerrit.instructure.com/19462
Reviewed-by: Shawn Meredith <shawn@instructure.com>
Product-Review: Shawn Meredith <shawn@instructure.com>
QA-Review: Shawn Meredith <shawn@instructure.com>
Tested-by: Shawn Meredith <shawn@instructure.com>
always return a child_events element if it is requested

the calendar event api has an option for including child events
if it is specified, we should return the field

if permissions are such that no child events are readable, return
an empty array

test plan
there aren't many places where this edge case comes up. the
easiest to get at is the json returned from reserving an
appointment slot
- as a student, use the api to reserve an appointment slot
- ensure the returned json includes a child_events element

Change-Id: I7a921e9ea68ae7896fd9c8197dc9ac91d0cfa979
Reviewed-on: https://gerrit.instructure.com/19390
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>