Lessons learned from upgrading Rails 2.1 to 2.3

Just my collection, so you do not need to find it out on your own 😉

  • :expire now is called :expires_in, update your cache calls or timed expiring will fail
  • get rspec edge/ rspec-rails edge
    detailed instruction
    also possible and easy: sudo gem install dchelimsky-rspec dchelimsky-rspec-railsyou may need to add this when you are on 1.1.99.9 and get
    no such file to load — spec/rails/example/routing_example_group
    from github
  • get webrat 0.4.2 (atm only by installing from github clone + rake gem + sudo gem install)
  • truncate(‘xxx’,3) ==> truncate(‘xxx’,:length=>3)
  • Model.find_by_xxx will now call Model.find with :conditions=>{:xxx=>something}, this broke some of my stubs/mocks, e.g. User.stubs(:find) worked before but now came in conflict with user login that used find_by_id
  • render :inline seems not to be testable, all my request.body from render :inline are blank now (rspec 1.1.12)
  • stub_model install rspec-rails-mocha — ./script/plugin install git://github.com/mislav/rspec-rails-mocha.git
  • count returns OrderedHash, so tests now look like xxx.to_a.should == [[‘name’,2]]
  • String.chars does not have the [] method anymore, so e.g. only “xxx”.mb_chars[1..4] will work
  • @template will no longer work in vie tests, use response instead
  • have_tag returns
    undefined method `id2name’ for {:instance_writer=>false}:Hash
    , upgrade the money gem!
  • controller tests are no longer able to call actions that are not defined (e.g. no action was defined because it only renders a view and does nothing or because the action was included from a module)
  • HopToad will silently fail, use this branch instead: http://github.com/pzingg/hoptoad_notifier (as long as thoughbot does not update their own of course)
  • work systematically e.g. rake spec:models, then rake spec:controllers … or you may get mad 😉

3 thoughts on “Lessons learned from upgrading Rails 2.1 to 2.3

  1. Hi!
    Thanks for relate your upgrade problems!
    I’ve upgradeded my rails too and having this same problem => String.chars does not have the [] method anymore, so e.g. only “xxx”.chars.to_a[1..4].to_s will work
    but i think is complicated do this “.to_a[1..lengthOfString].to_s”..
    Why don’t you just change for “xxx”.mb_chars ?
    i think it’s the same thing..

    Regards,
    Guilherme

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s