Now that the app is able to boot in both versions we can look at Phase 3 of the upgrade process. This phase can be a bit confusing in its details, the key is to remember that the goal is a running test suite and not a full passing test suite. A fully passing test suite is the next phase. The details of how this phase works could look like this:
Goal: Running test suite with failures that fail on the next version marked as pending. Once merged any new code will have to work in both versions.
Steps:
- Create a “CI running tests on both versions” story and plan according to your process.
- Once you start on the story: Create a branch for it
- Attempt to Get the specs running on the new version (It is okay if there are failures as long as the test suite is running)
- eg RAILS_ENV=test BUNDLE_GEMFILE=Gemfile-next bundle exec rspec
- Attempt to resolve any minor issues immediately that are related to getting the tests running
- Create new refactor stories as required for getting the tests running
- If you created new refactor stories
- Merge as much as you can into the main branch
- mark the main story as attempted/done/finish/etc
- plan the new refactor stories according to your process
- once new stories are done, start from Step 1 again
- Run the specs on CI
- add a “pending_on_upgrade” helper (pending “fix for rails upgrade” if Rails.version > “4.2”)
- Once CI is complete, mark all tests that fail on the next version using the “pending_on_upgrade” helper
- remove app boot test on CI (Not needed anymore because tests are running)
- Wait for a green build
- Add the changes to version control
- Share with the team that any new tests need to work on both versions
- Merge the branch into master
And that is it.
One thought on “Ruby on Rails Upgrade Phase 3: Running test suite”