Suggested Workflow
Set the ruby version in .ruby-version
to 2.3.5, then perform these steps one by one, fixing errors as they occur:
- Update gems as listed below, and bundle
- Boot a Rails console - see below for a list of changes you will probably need
- Run Specs with
--backtrace
option - Run Cucumber features (with Geordi's
--debug
option) - When all tests are green, look through your Gemfile and remove as many version constraints as possible.
- Boot the application in different environements to spot further issues, e.g.
rails console staging
Gem updates
-
Replace
ruby-debug
withbyebug
orpry
-
Replace
mysql
withmysql2, '< 0.3'
-
Remove
oniguruma
-
Remove
net-ssh
andnet-scp
-
Remove
fastercsv
-
Remove
cucumber_spinner
-
Remove
rspec_spinner
-
Update
rspec
to'< 2'
-
Lock
haml
to'= 3.1.7'
-
Unlock
andand
-
Unlock
rake
-
Lock
test-unit
to'= 1.2.3'
-
Lock
database_cleaner
to'< 1.3'
-
Lock
cucumber
to'< 2'
-
Lock
launchy
to'~> 2.1 '
-
Lock
paperclip
to'< 2.8'
-
Add
capybara-screenshot
and require it in Cucumber features. It will simplify debugging failing features.require 'capybara-screenshot/cucumber' Capybara::Screenshot.prune_strategy = { keep: 12 } # parallel_tests
-
TODO: Add
rspec-patches
gem from PH
Code changes
- Remove UTF8 hints at the top of files
- Pay tight attention to method privacy. Ruby 2.3 is more whiny about misusage, especially for Methods defined with
define_method
. - Use the spec_label implementation that works in Ruby 2
- Update
require
statements in features/support/env.rb. Use morerequire_relative
orrequire Rails.root.join('...')
- Fix Float rounding issues with
BigDecimal('12.3')
- Use
' '
fornbsp
helper instead of0xC2.chr + 0xA0.chr
- Remove
/s
regex modifier (your files are UTF8 anyway - Remove rcov
- In Rakefile, replace
require 'rake/rdoctask'
withrequire 'rdoc/task'
Error: wrong number of arguments (given 1, expected 0)
: Use proc
s instead of lambda
s where they are called with variable arguments. Look for named_scopes
.
Error: Attempt to call private method, NoMethodError
: Fix tests by replacing thing.private_method
with thing.send :private_method
will_paginate errors
: If you get pagination errors, make sure a collection isn't silently replaced after pagination:
# does not work
@contracts = @contracts.reject {...}
# works
@contracts.reject! {...}
YAML fixes
-
Change
# old date: order: [ :day, :month, :year ] # new date: order: - :year - :month - :day
Also see Upgrade from Ruby 1.8.7 to 2.1.5 – an incomplete guide.