Add explicit conversion Pathname -> String #8113
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is related to #8022 and some of our rspec tests (after adding fakefs bootstrap) will fail while calling this code because it relies on automatic conversion from object to String (via
to_str
).I first thought I'm gonna send a PR to fakefs to implement the
to_str
method, but after doing a quick search I rather decided to do explicit conversion here and here's why:https://www.ruby-forum.com/topic/4405700
I'm actually surprised that the tests are still green on Ruby 2.0.0+.
I was also thinking that we could add it elsewhere where we work with Pathname as String, but this is currently the one place which is heavily covered with tests and which bothers me most + I want to see your feedback on suggested approach first.
Feel free to run the tests with fakefs to see the failures:
https://github.com/radeksimko/homebrew-cask/commit/fe1095b5c81992aaa1e6c39a6afb0931d1191b30
It is only problem when ignoring the
shutup
helper, so you will need to use the environment variable from here:#8101