spec: fix sharding it_should_behave_like for rspec 2

Apparently the fact that a shared example group added its before/after
filters to the outer context was a bug, and it's been fixed in rspec 2.
So we can't use a shared example group to setup or mark pending sharding
specs anymore.

test plan: specs

Change-Id: I92b022e2e7125214e6bad38bf0a23da547fca984
Reviewed-on: https://gerrit.instructure.com/19182
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Duane Johnson <duane@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
added publish and draft icons to iconfont
test plan:
1- open app
2- verify class icon-draft and icon-publish work

Change-Id: I3cc4c3ec6bf054c74ad3f947dc28d0cedaf3123b
Reviewed-on: https://gerrit.instructure.com/18994
Reviewed-by: Chris Hart <chris@12spokes.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
clean up error report error handling

test plan:
 * try to abuse the javascript record_error endpoint (send garbage
   data for the id, try to do other stuff to make it fail)
 * it should record ever so slightly more useful information

Change-Id: Ibe83fdab3a77175ef1ab73b6c5210ac7265644ae
Reviewed-on: https://gerrit.instructure.com/19041
Reviewed-by: Jacob Fugal <jacob@instructure.com>
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>
fix importing bb9 out-of-order matching questions with distractions

fixes CNVS-4927

test plan:
 - import a blackboard .zip containing a quiz with a matching question
   where the answers are out of order and there are additional
   right-side options (distractions) present
   (such as "test test" attached to CNVS-4927)
 - the questions should be imported correctly

Change-Id: I77ef0019c2d430ee28cdbc79006a2a7971baafc6
Reviewed-on: https://gerrit.instructure.com/19093
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
fix logging parameter filtering in rails 3.1+

filter_parameter_logging is deprecated in 3.0 and removed in 3.1

test plan: when logging in, your password should still be filtered from
the log file in both rails 2 and rails 3

Change-Id: I697d5a4aca1a7501fe84a52c0097f8ae81074a0a
Reviewed-on: https://gerrit.instructure.com/19085
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
fix CanvasLogger for rails 3.1+

The implementation of ActiveSupport::BufferedLogger changed quite a bit.
By delegating to the superclass #add method we can keep working with
both rails 2 and rails 3.

test plan: use the default logger in config/logging.yml , and logging
should still write to log/*.log and include the context ids in both
rails 2 and rails 3

Change-Id: I15864384607bf0fee1a28c0051c75749119b73df
Reviewed-on: https://gerrit.instructure.com/19091
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
change class_inheritable_accessor and write_inheritable_hash to class_attribute

for rails 3.1+ compatibility

Change-Id: If86dbf1c3fe9d2f42aac16726c02af1eb5a7b86c
Reviewed-on: https://gerrit.instructure.com/19095
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
arel-ify models

closes CNVS-4707

Change-Id: I32c8ec5a53525f89cf232890eaac790fbc2b4744
Reviewed-on: https://gerrit.instructure.com/18745
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
arel-ify lib

excluding api_find, which needs more work

refs CNVS-4706

Change-Id: I013d0660ff2b8dbe2abf6a5c973bd1203f432f99
Reviewed-on: https://gerrit.instructure.com/18921
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
re-check browser support if user_agent changes, fixes CNVS-5025

previously we stored whether your browser is supported in the session
(so as not to add extra overhead to every request). we still do that, but
now we re-check whenever the user_agent string changes

test plan:
1. install an older chrome or firefox
2. log in to canvas
3. see the orange bar
4. upgrade your browser
5. you should not see the orange bar in canvas
6. additionally, if you change your user_agent string on the fly, the
   orange bar should show or not show accordingly when you refresh

Change-Id: I5c21c3c7adf30d4dd5b90189c3d9b3a33f8fa33f
Reviewed-on: https://gerrit.instructure.com/19189
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Stanley Stuart <stanley@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
don't import all files in migration if copy[:files] is missing

fixes a problem where having the copy[:files] value missing
(as opposed to an empty hash) in the migration settings
would cause every attachment to be imported in

test plan:
* import a migration
* on the "choose content" screen, make sure that
none of the boxes under "Files" are checked.
* confirm that the import did not copy every file
(files that are linked to in other imported content
will be implicitly imported)

fixes #CNVS-4817

Change-Id: I53c736bdc8cf6835e4460c0a43349be1c7b04959
Reviewed-on: https://gerrit.instructure.com/19161
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
fix future enrollments scope

include root_account, rather than join

refs #CNVS-4813

Change-Id: I81f08d8256c0efee701b02caafee476dd022332c
Reviewed-on: https://gerrit.instructure.com/19193
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Bracken Mosbacker <bracken@instructure.com>
raise error for unescaped ampersands in external tool urls

test plan:
* Create an external tool "by xml", with a "launch_url" tag
(or any custom property of name "url"),
that includes an unescaped ampersand:
 (e.g. "www.example.com?a=1&b=2")
* Confirm that an error is raised indicating
the ampersand needs to be escaped
 (e.g. "www.example.com?a=1&amp;b=2")

fixes #CNVS-1324

Change-Id: Id90d216e2d9039187e8a8f4327e2413d07164b04
Reviewed-on: https://gerrit.instructure.com/18872
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
Reviewed-by: Brad Humphrey <brad@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
fix margin on "please log in" warning message

fixes CNVS-5039

test plan: go to any page that needs auth such as /courses/X when not
logged in. the "please log in" header shouldn't overlap with the "you
need to be logged in..." message.

Change-Id: Ide1b239a14ee8aa58608055097d88487b65e00ba
Reviewed-on: https://gerrit.instructure.com/19211
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
arel-ify scopes

s/named_scope/scope/g

refs CNVS-4707

Change-Id: I930d229fc9985c7c0096a0f4888933addd4f3aee
Reviewed-on: https://gerrit.instructure.com/18834
Reviewed-by: Duane Johnson <duane@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
fix datafixup broken by arel-ifying

Change-Id: I44dd976aa4e4ea687f69cc11de2383c5c2ccae5f
Reviewed-on: https://gerrit.instructure.com/19229
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
separate user and context ids in permission caching keys

cached_context_grants_right?'s key generation scheme could
potentially cause the wrong permissions to be returned

with the old scheme, both (course_123, user_45) and
(course_12, user_345) would key cache entries with "course_12345".

this could cause already cached permissions to be used when they
shouldn't be in some ridiculously unlikely scenarios, made all
the more unlikely because cached_context_grants_right? is an
in-process cache

Change-Id: I12d4f2a7e982d2a98825df31b35a784366df9c36
Reviewed-on: https://gerrit.instructure.com/19185
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
QA-Review: Joel Hough <joel@instructure.com>
update rake to 10.0.4

/me hates the bundle exec

test plan:
 * rake tasks should work

Change-Id: I68da20c9ac7e54053612afc4bbbea77d55dce054
Reviewed-on: https://gerrit.instructure.com/19223
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Duane Johnson <duane@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
spec: calendar 2 failure fix should marke undated

Change-Id: I969877c808d028b45828e5d5b4e1cea6f8206920
Reviewed-on: https://gerrit.instructure.com/19230
Reviewed-by: Bryan Madsen <bryan@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Tested-by: Bryan Madsen <bryan@instructure.com>
refactor + fix message students who dialog for quiz show

test plan:
  - as a teacher make a new quiz and publish it.
  - make sure one or two students in the course have taken the quiz
  - in the cog menu on the quiz show page
    (/courses/:course_id/quizzes/:quiz_id), click on "Message Students
    Who..."
  - You should see students who have taken the quiz in the dialog when
    you select "Have taken the quiz". You should see students who
    haven't taken the quiz when you select "Have NOT taken the quiz"
  - Try submitting the message with a blank message. You should get a
    warning box. Now, make a message to each group of students and save
    the message. Check that each student received the message.
  - Now make the rest of the students finish the quiz. Open the dialog
    again and fill out a message in the textbox. Select "students who
    have NOT taken the quiz". It should be empty. Try sending the
    message by clicking "Send Message". You should immediately get an
    error that the group of students you selected is empty and you
    should choose a different group of students.

fixes CNVS-4743

Change-Id: I2199bd7a18089726251bd0244bc618446db26d07
Reviewed-on: https://gerrit.instructure.com/18869
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>