Skip to content

Instantly share code, notes, and snippets.

View randyv128's full-sized avatar

Randy Villanueva randyv128

  • Joined Oct 5, 2025
View GitHub Profile
# Monkey patch for ActionController::TestRequest to automatically enable sessions
# with Rails-configured session store (e.g., memcached) in tests
#
# Place this in: test/support/action_controller_test_request_patch.rb
# Then require it in test/test_helper.rb
#
# Usage:
# request = ActionController::TestRequest.create
# # or with initial session data:
# request = ActionController::TestRequest.create({}, { user_id: 123, foo: 'bar' })