after_transaction_commit gem extraction

refs CNVS-15881

our delayed_job depends on this, so I'm pulling it out into a gem first,
so that we can fully gemify our fork of delayed_job and use it in other
apps.

I modified the code to be built on top of the after_commit callback
functionality added in rails3, and I pulled in the test_after_commit gem
(after making a fix to it), which emulates transaction callbacks in test
mode. This makes it easier to write tests that interacts with these
callbacks, and cleans up some code in the app that was checking for test
mode and changing behavior. Fortunately, it behaves well with once-ler.

Side note: now that we are on rails3, we could replace some, but not
all, of our usage of after_transaction_commit with after_commit AR
callbacks. I didn't do that in this commit, to minimize churn.

test plan: things that happen in commit callbacks should still happen as
expected. for instance, with caching enabled, changing a /plugins
setting should still take effect immediately, because the cache is
cleared in a commit callback.

Change-Id: I66af5f66bf9fa9354352ed37edec8bd92d8e39c8
Reviewed-on: https://gerrit.instructure.com/41819
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>