Fixes File#check_file_existence! always prints empty path. Closes #34
This commit is contained in:
parent
124a138254
commit
68c958df0d
@ -379,9 +379,7 @@ module FakeFS
|
||||
end
|
||||
|
||||
def check_file_existence!
|
||||
unless @file
|
||||
raise Errno::ENOENT, "No such file or directory - #{@file}"
|
||||
end
|
||||
raise Errno::ENOENT, @path unless @file
|
||||
end
|
||||
|
||||
def file_creation_mode?
|
||||
|
@ -84,13 +84,14 @@ class FakeFileTest < Test::Unit::TestCase
|
||||
assert_equal "bar", @file.content
|
||||
end
|
||||
|
||||
def test_gh_34_doesnt_print_path_of_nonexisting_file
|
||||
def test_raises_an_error_with_the_correct_path
|
||||
path = "/some/non/existing/file"
|
||||
begin
|
||||
FakeFS::File.new "/some/non/existing/file"
|
||||
FakeFS::File.new path
|
||||
msg = nil
|
||||
rescue Errno::ENOENT => e
|
||||
msg = e.message
|
||||
end
|
||||
assert_match /^No such file or directory - No such file or directory - $/, msg
|
||||
assert_equal "No such file or directory - #{path}", msg
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user