mocks.cr
mocks.cr copied to clipboard
Fix all specs and deprecation warnings for Crystal 0.31.1
I fixed all the specs and deprecation warnings for Crystal 0.31.1:
$ crystal spec
.......................................................
Finished in 3.85 milliseconds
55 examples, 0 failures, 0 errors, 0 pending
Changes:
Fix Arithmetic overflow (OverflowError) in the hash calculations
Crystal added new "wrapping" arithmetic operators in 0.27.0, and the hash calculations now raise an OverflowError unless these are used.
Fix Time.now deprecation
Time.now was deprecated in Crystal 0.28.0, and needs to be replaced with Time.local.
Need to mock Crystal::System::File.exists?
(Not sure when this changed, or if it's related to other changes in the Crystal language.)
- file.cr requires:
- crystal/system/file, which requires either:
So I updated the test to mock Crystal::System::File, which fixes the failing test. (But maybe this is just a temporary workaround.)
Original PRs:
- https://github.com/waterlink/mocks.cr/pull/40
- https://github.com/waterlink/mocks.cr/pull/42