Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update fakefs to fix test failures on Ruby 3.2.2 #21588

Merged
merged 2 commits into from Oct 19, 2023

Conversation

AliSoftware
Copy link
Contributor

@AliSoftware AliSoftware commented Oct 19, 2023

Checklist

  • I've run bundle exec rspec from the root directory to see all new and existing tests pass
  • I've followed the fastlane code style and run bundle exec rubocop -a to ensure the code style is valid
  • I see several green ci/circleci builds in the "All checks have passed" section of my PR (connect CircleCI to GitHub if not)
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary.
  • I've added or updated relevant unit tests.

Motivation and Context

We kept having NameError: undefined method `=~' for class `FakeFS::Pathname' errors when running the tests (bundle exec rspec) in Ruby 3.2.2 on our Macs.

Description

Updating fakefs fixed those failures that happened running bundle exec rspec on the repo in Ruby 3.2.2.

Initially I updated fakefs to its latest ~> 1.x version, which was 1.9. But then I later noticed (thanks, CI) that fakefs 1.9 requires Ruby >= 2.7, while fastlane still supports Ruby 2.6 (spec.required_ruby_version = '>= 2.6'), so I ended up forcing using fakefs 1.8, which is the latest version of that gem that supports Ruby 2.6 (>=2.4).

PS: At some point we probably want to add Ruby 3.2.2 to our array of Ruby versions tested by CI, but that's improvements for another PR (I think @rogerluan already tried a while ago and encountered some hiccups while trying so paused his work on this?)

Testing Steps

Run:

rbenv local 3.2.2
bundle exec rspec

And ensure that you don't get errors related to FakeFS::Pathname like the ones below (that we had before the update):

An error occurred while loading ./deliver/spec/[…]_spec.rb.
Failure/Error: undef =~

NameError:
  undefined method `=~' for class `FakeFS::Pathname'
# ./deliver/spec/loader_spec.rb:2:in `require'
# ./deliver/spec/loader_spec.rb:2:in `<top (required)>'
/Users/me/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/fakefs-1.2.3/lib/fakefs/pathname.rb:16: warning: already initialized constant FakeFS::Pathname::TO_PATH
/Users/me/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/fakefs-1.2.3/lib/fakefs/pathname.rb:16: warning: previous definition of TO_PATH was here
/Users/me/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/fakefs-1.2.3/lib/fakefs/pathname.rb:18: warning: already initialized constant FakeFS::Pathname::SAME_PATHS
/Users/me/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/fakefs-1.2.3/lib/fakefs/pathname.rb:18: warning: previous definition of SAME_PATHS was here
/Users/me/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/fakefs-1.2.3/lib/fakefs/pathname.rb:114: warning: already initialized constant FakeFS::Pathname::SEPARATOR_LIST
/Users/me/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/fakefs-1.2.3/lib/fakefs/pathname.rb:114: warning: previous definition of SEPARATOR_LIST was here
/Users/me/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/fakefs-1.2.3/lib/fakefs/pathname.rb:115: warning: already initialized constant FakeFS::Pathname::SEPARATOR_PAT
/Users/me/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/fakefs-1.2.3/lib/fakefs/pathname.rb:115: warning: previous definition of SEPARATOR_PAT was here

To fix failure on `bundle exec rspec` in Ruby 3.2.2

We kept having "NameError: undefined method `=~' for class `FakeFS::Pathname'" errors when running the tests in Ruby 3.2.2 on our Macs
As fakefs 1.9+ requires Ruby 2.7 while fastlane's gemspec still officially supports 2.6
@AliSoftware AliSoftware changed the title Update fakefs from 1.2 to 1.9 Update fakefs to fix test failures on Ruby 3 Oct 19, 2023
Copy link
Member

@rogerluan rogerluan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I think @rogerluan already tried a while ago and encountered some hiccups while trying so paused his work on this?)

Correct!


Thanks for this @AliSoftware ! 🤗

@rogerluan rogerluan changed the title Update fakefs to fix test failures on Ruby 3 Update fakefs to fix test failures on Ruby 3.2.2 Oct 19, 2023
@rogerluan rogerluan merged commit 5c63bd5 into master Oct 19, 2023
7 checks passed
@rogerluan rogerluan deleted the update-fakefs-ruby3-tests branch October 19, 2023 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants