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

Handle relative source path in create_link #identical? #701

Merged
merged 2 commits into from
Dec 17, 2019

Conversation

chrisandreae
Copy link
Contributor

🌈🌈🌈

Rationale

Thecreate_link action's documented behaviour is to interpret the source parameter as a relative path. While not explicitly stated, the implementation is that the source path is relative to the destination. However, #identical? treats the source pathrender as an absolute path when calling File.identical?.

Changes

Update #identical? to interpret the source path relative to the destination.

Alter CreateLink spec to allow variations in the source path to be tested, add spec testing #identical? for a relative source path.

Discussion

You may or may not wish to accept the refactoring to the CreateLink spec. It felt like pulling the construction of the action apart like this was the cleanest way to allow this kind of variation between examples, but it is a broader change.

When creating a symlink, the source path may be relative to the destination. If
this is the case, #identical? fails becase it interprets it as an absolute path.
Update #identical to resolve the source path before comparing.
@rafaelfranca rafaelfranca merged commit ac240ce into rails:master Dec 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants