make the library work with globally enabled frozen-string-literals#1598
Conversation
|
in order to run the tests and see the error you have to run them this way RUBYOPT='--enable=frozen-string-literal' bundle exec appraisal rails_7_1 rspec spec/and ofc you can replace |
|
I believe it's a positive step to take. If everyone is in agreement, let's proceed with updating the CI to run with this configuration: RUBYOPT='--enable=frozen-string-literal' |
|
Thanks for the feedback @vsppedro I will put some hours of work on this issue and update this pull request as I progress |
|
Nice work, @amalrik. I think we need to add RUBYOPT='--enable=frozen-string-literal' to the CI configuration to be sure that is working. What do you think? shoulda-matchers/.github/workflows/ci.yml Line 64 in d611911 shoulda-matchers/.github/workflows/ci.yml Line 66 in d611911 |
tks man I agree. |
|
To be honest, I'm not a fan of it, but I think it's a good thing to have to ensure that we aren't introducing anything that could inadvertently alter a string and potentially disrupt this feature. Let me check how other gems approach this. |
|
hey @vsppedro could you check this? |
more refacts to make tests pass with frozen strings fix linter errors clean up some code enable frozen string literals on CI
e8bf776 to
b762994
Compare
thoughtbot#1598 fixed most frozen-string-literal violations, allowing the test suit to pass with `--enable=frozen-string-literal`. However, `render_with_layout_matcher` had a violation in its description method that wasn't exercised by tests, and therefore still causes deprecation warnings under Ruby 3.4 (and failures with the flag enabled) This commit adds tests that exercise `RenderWithLayoutMatcher#description`, and fixes the literal-string violation.
#1598 fixed most frozen-string-literal violations, allowing the test suit to pass with `--enable=frozen-string-literal`. However, `render_with_layout_matcher` had a violation in its description method that wasn't exercised by tests, and therefore still causes deprecation warnings under Ruby 3.4 (and failures with the flag enabled) This commit adds tests that exercise `RenderWithLayoutMatcher#description`, and fixes the literal-string violation.
fixes #1563
EDIT:after some more verification I noticed we need more changes in order to make the tests pass with the frozen-string option globally enabled. LMK if you guys think this is a useful contribution to project.