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

Commit

Permalink
Merge pull request #1383 from r7kamura/feature/file-test-exists
Browse files Browse the repository at this point in the history
Prevent deprecation warning from `expect(FileTest).to exist(x)`
  • Loading branch information
JonRowe authored Sep 12, 2022
2 parents 853c5fd + e176f25 commit d49d0e4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rspec/matchers/built_in/exist.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def predicates
end

def deprecated(predicate, actual)
predicate == :exists? && File == actual
predicate == :exists? && (File == actual || FileTest == actual)
end
end
end
Expand Down
6 changes: 6 additions & 0 deletions spec/rspec/matchers/built_in/exist_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ def send
expect(File).to exist __FILE__
end
end

context 'FileTest has deprecated exists?' do
it 'will not call exists? triggering the warning' do
expect(FileTest).to exist __FILE__
end
end
end
end

Expand Down

0 comments on commit d49d0e4

Please sign in to comment.