This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This class wraps an ActiveRecord database transaction, and contains a workaround | |
# for a memory bloat issue that happens when you create a large number of ActiveRecord | |
# model instances within a database transaction, and those model classes use the | |
# paper_trail gem for versioning. | |
# | |
# This workaround temporarily removes transaction callbacks registered on ActiveRecord | |
# classes by paper_trail, and then manually calls these callbacks once the transaction | |
# has finished. The precense of the transaction callbacks is what causes ActiveRecord | |
# to hold onto the model instances until the transaction finishes. ActiveRecord will | |
# not hold onto the model instances if no transaction callbacks are defined. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adds support for http digest authentication in Rails 3 | |
# Inspired by: http://lightyearsoftware.com/2009/04/testing-http-digest-authentication-in-rails/ | |
# Place this code in test/test_helper.rb | |
# In your test, call authenticate_with_http_digest prior to calling get, post, put or delete | |
# Tested with Rails 3.0.7 | |
class ActionController::TestCase | |
require 'digest/md5' | |
def authenticate_with_http_digest(user = API_USERNAME, password = API_PASSWORD, realm = API_REALM) |