Rails 2.3.3 upgrade notes: rack, mocha, and _ids

Posted by Jon
on Wednesday, July 29

I upgraded two apps to Rails 2.3.3 today. It’s a minor release, and there’s not much to report. But I did run into three minor problems.

Mocha

Mocha 0.9.5 started throwing an exception:

NameError: uninitialized constant Mocha::Mockery::ImpersonatingAnyInstanceName

A quick update to Mocha 0.9.7 cleared this up.

Array parameters in tests

In functional tests with Test::Unit, passing an array to a parameter stopped working. Previously, I had something like this:


post :create, :user => {:role_ids => [1,2,3]}

This would post the following parameters:


"role_ids"=>["1", "2", "3"]

But after the 2.3.3 update, I started seeing an error:

NoMethodError: undefined method `each' for 1:Fixnum

I’m not sure why this stopped working. (Anyone know?) Changing the integers to strings clears up the error:


post :create, :user => {:role_ids => ["1","2","3"]}

Or


post :create, :user => {:role_ids => [1.to_s,2.to_s,3.to_s]}

Rack

Rack apparently no longer comes bundled with Rails. Or at least deployment failed on cap deploy: RubyGem version error: rack(0.4.0 not ~> 1.0.0).

The solution was simple: install (or vendor) Rack 1.0.0.


config.gem 'rack', :version => '>= 1.0.0'
Comments

Leave a response

  1. Luke FranclJuly 29, 2009 @ 02:17 PM

    I was trying to upgrade an app to 2.3.3 and I ran into the Mocha problem (I even whined about it on Twitter). I was hoping someone else would figure it out!

  2. Matthew BealeJuly 29, 2009 @ 03:45 PM

    Also SMTP mail is broken on 1.8: https://rails.lighthouseapp.com/projects/8994/tickets/2340-action-mailer-cant-deliver-mail-via-smtp-on-ruby-191

    And the JSON interface mentioned in the RoR weblog post is completely undocumented. I’ve asked for clarification, but still waiting on something.

    The arrays in tests issue is fixed in 2-3-stable.

  3. Matthew BealeJuly 30, 2009 @ 09:57 AM

    Also rack reloading foobars your development mode unpredictably: https://rails.lighthouseapp.com/projects/8994/tickets/2948-exception-a-copy-of-actorscontroller-has-been-removed-from-the-module-tree-but-is-still-active

    Messy release.