In a not too far away future, you will be upgrading your well tested application for Rails 3.x. Along the way, you will find that the API for errors has changed and that no errors is no longer nil
, it’s an empty array.
You will need to fix your real code to take this into account, but here’s a little help to fix the tests if you have a good global find&replace tool:
find (regular expression): assert_equal(\s+)(.*),(.*)\.errors(\[([^\]]+)\])$ replace by assert_equal$1[$2],$3.errors[$5]
Gaspard
Gaspard Bucher
comments