Skip to content
This repository has been archived by the owner on Nov 30, 2024. It is now read-only.

Prevent deprecation warning from expect(FileTest).to exist(x) #1383

Merged
merged 1 commit into from
Sep 12, 2022

Conversation

r7kamura
Copy link
Contributor

@r7kamura r7kamura commented Sep 11, 2022

I found that expect(FileTest).to exist(x) also outputs deprecation warnings in the same way as expect(File).to exist(x) before #954.

FileTest.exists? is a deprecated name, use FileTest.exist? instead

I confirmed that this warning is displayed on Ruby 2.7.6 and Ruby 3.1.2.

So it would be nice that we also support FileTest as well as File. It won't be used that much, but it's not a big change and it would be better to support it.

Copy link
Member

@pirj pirj left a comment

Choose a reason for hiding this comment

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

Thank you!

@@ -81,7 +81,7 @@ def predicates
end

def deprecated(predicate, actual)
predicate == :exists? && File == actual
predicate == :exists? && [File, FileTest].include?(actual)
Copy link
Member

Choose a reason for hiding this comment

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

Cosmetic: File == actual || FileTest == actual?

```
FileTest.exists? is a deprecated name, use FileTest.exist? instead
```
@r7kamura r7kamura force-pushed the feature/file-test-exists branch from 1d4c923 to e176f25 Compare September 12, 2022 07:05
@JonRowe JonRowe merged commit d49d0e4 into rspec:main Sep 12, 2022
JonRowe added a commit that referenced this pull request Sep 12, 2022
JonRowe added a commit that referenced this pull request Sep 12, 2022
Prevent deprecation warning from `expect(FileTest).to exist(x)`
JonRowe added a commit that referenced this pull request Sep 12, 2022
@r7kamura r7kamura deleted the feature/file-test-exists branch September 12, 2022 09:09
pirj pushed a commit that referenced this pull request Nov 1, 2022
pirj pushed a commit that referenced this pull request Nov 1, 2022
JonRowe added a commit that referenced this pull request Nov 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants