-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
assert_file understands paths with special characters #20605
Conversation
@senny is this fix valid? |
@@ -23,7 +23,7 @@ module Assertions | |||
# end | |||
# end | |||
def assert_file(relative, *contents) | |||
absolute = File.expand_path(relative, destination_root).shellescape | |||
absolute = File.expand_path(relative, destination_root).gsub(" ", "\\ ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you point me in the direction why this gsub
is needed?
Given:
$ ls spaces
file with spaces.txt v0.1.4~alpha+nightly
The following script outputs:
path = File.expand_path("../spaces/file with spaces.txt", __FILE__)
path # => /Users/senny/Projects/ruby/spaces/file with spaces.txt
File.exist?(path) # => true
path = File.expand_path("../spaces/v0.1.4~alpha+nightly", __FILE__)
path # => /Users/senny/Projects/ruby/spaces/v0.1.4~alpha+nightly
File.exist?(path) # => true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, please do.
assert_file understands paths with special characters
Thank you 💛 |
assert_file understands paths with special characters Conflicts: railties/CHANGELOG.md
`shellwords` is no longer needed from rails#20605.
fixes #20042