FYI: CII Best Practices badge project in process of transitioning Rails 5->Rails 6

David A. Wheeler

FYI: the CII Best Practices badge project’s web application is slowly working to transition from Rails 5 to Rails 6.

The code generally works on Rails 6 already; the problem is that we’ve always done a lot of testing & some of our current system tests don’t work on Rails 6. If you’re curious about the details, see below.

--- David A. Wheeler

=== DETAILS ===

The CII Best Practices badge project tries to follow good practices, including good automated testing and keeping up our dependencies. Sometimes real life is complicated, though.

When the badging project was started, we chose to use Ruby on Rails, a widely-used framework that’s often used for these kinds of projects (that’s still true; GitHub and GitLab, for example, use them). By itself, no problem. We wanted to have good system tests (where an actual headless browser is used for testing, to enable realistic tests), but IIRC Rails didn’t have such functionality built in at the time. So for our system tests we use the library “minitest-rails-capybara”. Unfortunately, that library only has support for up through Rails version 5 (the latest version of minitest-rails-capybara requires railties 5.X, while Rails 6 requires railties 6.X). The obvious solution is to switch to Rails’ standard system test framework, as Rails *does* now have a system test framework.

However, that means we need to convert our existing system tests to the new Rails system test framework. There’s nothing complex about that, it just takes time. In addition, we want to modify those tests so that they can be run in parallel; Rails 6 supports parallel tests, which can greatly decrease test time.

We also had to eliminate one other gem (library) so that we can move to Rails 6, namely fastly-rails, as it didn’t support Rails 6. That’s already been done. I did try running the code on Rails 6 after we removed fastly-rails; there was a problem with the logout button but otherwise things seemed okay. It’s possible that there be some other bumps, but that will be hard to tell until we get all our system tests working on Rails 6.

Switching to Rails 6 is noted as an issue here: