Skip to content

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 committed Sep 12, 2022
1 parent a843331 commit 8c73bf6
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 8c73bf6

Please sign in to comment.