Ensure RSpec works with Ruby 3.0 frozen strings
Created by: myronmarston
From what I understand, in Ruby 3 string literals will be frozen by default. In Ruby 2.3 there's a magic comment to turn it on for a file:
# frozen_string_literal: true
We should begin the process of adding this to all our ruby files (in all projects) to make sure we're compatible (and to gain the speed benefits it brings). We may also want to run things with --enable-frozen-string-literal
so they are frozen project-wide.
This blog contains more info: https://wyeworks.com/blog/2015/12/1/immutable-strings-in-ruby-2-dot-3
It looks like rubocop has a check for this:
http://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/FrozenStringLiteralComment
...so once we have set this up it would be good to upgrade rubocop and enable that so it stays in place.
This project might help as well: