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
--backtraceoption - Run Cucumber features (with Geordi's
--debugoption) - 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-debugwithbyebugorpry -
Replace
mysqlwithmysql2, '< 0.3' -
Remove
oniguruma -
Remove
net-sshandnet-scp -
Remove
fastercsv -
Remove
cucumber_spinner -
Remove
rspec_spinner -
Update
rspecto'< 2' -
Lock
hamlto'= 3.1.7' -
Unlock
andand -
Unlock
rake -
Lock
test-unitto'= 1.2.3' -
Lock
database_cleanerto'< 1.3' -
Lock
cucumberto'< 2' -
Lock
launchyto'~> 2.1 ' -
Lock
paperclipto'< 2.8' -
Add
capybara-screenshotand 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-patchesgem 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
requirestatements in features/support/env.rb. Use morerequire_relativeorrequire Rails.root.join('...') - Fix Float rounding issues with
BigDecimal('12.3') - Use
' 'fornbsphelper instead of0xC2.chr + 0xA0.chr - Remove
/sregex 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
procs instead oflambdas where they are called with variable arguments. Look fornamed_scopes. - Error: Attempt to call private method, NoMethodError
-
Fix tests by replacing
thing.private_methodwiththing.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.