Fix birthtime specs on old Linux

This commit is contained in:
Nobuyoshi Nakada 2025-06-06 13:46:12 +09:00
parent 180214287e
commit 2eb0a1a749
No known key found for this signature in database
GPG key ID: 3582D74E1FEE4465
Notes: git 2025-06-06 06:43:03 +00:00
2 changed files with 4 additions and 4 deletions

View file

@ -21,13 +21,13 @@ platform_is :windows, :darwin, :freebsd, :netbsd, :linux do
File.birthtime(@file) # Avoid to failure of mock object with old Kernel and glibc
File.birthtime(mock_to_path(@file))
rescue NotImplementedError => e
skip e.message if e.message.start_with?("birthtime() function")
e.message.should.start_with?("birthtime() function")
end
it "raises an Errno::ENOENT exception if the file is not found" do
-> { File.birthtime('bogus') }.should raise_error(Errno::ENOENT)
rescue NotImplementedError => e
skip e.message if e.message.start_with?("birthtime() function")
e.message.should.start_with?("birthtime() function")
end
end
@ -45,7 +45,7 @@ platform_is :windows, :darwin, :freebsd, :netbsd, :linux do
@file.birthtime
@file.birthtime.should be_kind_of(Time)
rescue NotImplementedError => e
skip e.message if e.message.start_with?("birthtime() function")
e.message.should.start_with?("birthtime() function")
end
end
end

View file

@ -18,7 +18,7 @@ platform_is(:windows, :darwin, :freebsd, :netbsd,
st.birthtime.should be_kind_of(Time)
st.birthtime.should <= Time.now
rescue NotImplementedError => e
skip e.message if e.message.start_with?("birthtime() function")
e.message.should.start_with?("birthtime() function")
end
end
end