Handle test failure of mock object

Fixup 4c26a38ed3c

https://rubyci.s3.amazonaws.com/amazon2/ruby-master/log/20250601T213003Z.fail.html.gz

```
1)
An exception occurred during: Mock.verify_count
File.birthtime accepts an object that has a #to_path method FAILED
Mock 'path' expected to receive to_path(:any_args) exactly 1 times
but received it 0 times
/home/chkbuild/chkbuild/tmp/build/20250601T213003Z/ruby/spec/ruby/core/file/birthtime_spec.rb:4:in 'block in <top (required)>'
/home/chkbuild/chkbuild/tmp/build/20250601T213003Z/ruby/spec/ruby/core/file/birthtime_spec.rb:3:in '<top (required)>'
```
This commit is contained in:
Hiroshi SHIBATA 2025-06-02 08:50:54 +09:00
parent 3fd2d54a0a
commit 20d7db8cba
No known key found for this signature in database
GPG Key ID: F9CF13417264FAC2

View File

@ -18,6 +18,7 @@ platform_is :windows, :darwin, :freebsd, :netbsd, :linux do
end
it "accepts an object that has a #to_path method" 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")