rails 3 beta – “uninitialized constant ActionDispatch::Integration::Session::Test”

March 15, 2010

in software,web

I just set up a new rails project with the 3.0 beta, and when I tried to run some cucumber tests I got the following:

uninitialized constant ActionDispatch::Integration::Session::Test (NameError)

Seems that there isn’t an explicit require of ‘test/unit/testcase’ in rails/actionpack/lib/action_dispatch/testing/integration.rb, but here is this line:

127
      include Test::Unit::Assertions

To get around the problem you can toss a “require ‘test/unit/testcase’” at the top of the integration.rb file, but with rails 3.0′s use of bundler it’s possible that the file will be written over (and hence remove the fix) if you do a “bundle update”. Instead (and yes this is hackish), you can add the require line to the top of your config/environments/test.rb file:

# hack to get around a rails bug
require 'test/unit/testcase'

And you shouldn’t get that error anymore.

I haven’t fully investigated this issue, when I get a few moments I’ll try and drop a ticket in lighthouse. I dug around a bit, and found this, this, and this though, which may help (i believe the first two are for the 2.x series of rails — I’m not sure if the changes are still correct for rails 3).

booyah

Leave a Comment

Previous post:

Next post: