diff --git a/spec/lib/gitlab/utils/file_info_spec.rb b/spec/lib/gitlab/utils/file_info_spec.rb
index 480036b2fd025bf86cb77f79963e62af369586d9..1f52fcb48b6eb55ce99c30d733810eb91581c6d6 100644
--- a/spec/lib/gitlab/utils/file_info_spec.rb
+++ b/spec/lib/gitlab/utils/file_info_spec.rb
@@ -16,7 +16,7 @@
 
   describe '.linked?' do
     it 'raises an error when file does not exist' do
-      expect { subject.linked?('foo') }.to raise_error(Errno::ENOENT)
+      expect { subject.linked?("#{tmpdir}/foo") }.to raise_error(Errno::ENOENT)
     end
 
     shared_examples 'identifies a linked file' do
@@ -56,7 +56,7 @@
 
   describe '.shares_hard_link?' do
     it 'raises an error when file does not exist' do
-      expect { subject.shares_hard_link?('foo') }.to raise_error(Errno::ENOENT)
+      expect { subject.shares_hard_link?("#{tmpdir}/foo") }.to raise_error(Errno::ENOENT)
     end
 
     shared_examples 'identifies a file that shares a hard link' do