bblimke/webmock — pull request #285 by gotwalt (2013-06-09 14:05:35+00:00)
Title: Compatibility fix for to_rack mocking + Rails 4

I wish I understood this problem better, but using WebMock's `to_rack` method when testing Rails 4 apps raises exceptions on any method that touches the session. Digging in to the Session class in ActionPack (https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/request/session.rb) is become clear that they expect a rack environment variable called 'rack.session.options' to be passed in in order for Session#load! to not explode on line 169 when setting a key in a nil hash.

The attached change is a 'works-for-me' patch I made after spending hours trying to fix this issue. YMMV.