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' |

