The Blog

Posts from September 2010

Sep 22

Cookie Monster

By David Czarnecki

I thought if you didn’t use Rails sessions, that Rails wouldn’t create a session cookie?

In any event, one of our engineers had put together a simple Rack middleware for destroying cookies.

You can find the code for cookie_monster.rb as a Gist on GitHub.

If this helps you, great. I’d also like to understand why a session cookie gets created? It seems like it’s happening in the bowels of Rails. This is a Rails 2.3.8 application by-the-dubz.

Sep 10

Rails 3 + Mocha Load Order Gotcha

By Tom Quackenbush

The other day we ran into an issue in one of our new Rails 3 apps that is using mocha for mocking. It seemed that once a stub was mocked in one test, it would carry over to each subsequent test causing failures. Mocks were not being torn down correctly… Since mocha does not lie, it had to be something within our setup causing it to fail…

Thankfully, a tweet response from @elise_huard offered the following solution:

@tquackenbush yes, @threedaymonk suggested a fix: to fix load order, so do gem 'mocha', :require => false and require 'mocha' in test_helper”

Worked like a charm! A tip of the hat to @elise_huard and @threedaymonk for the help!