The mocks.cr shard is really amazing! It’s one of the first things I looked for when I was researching testing with Crystal, and I can’t imagine working on a large test suite without a good mocking library.
However, I got stuck when I was trying to mock
File.read_lines, and I realized that this is because mocks.cr can’t mock a method when it has some default values for arguments.
crystal tool expand was super helpful to expand the mocking macros. However, these macros are pretty insane, so I’m not too sure how to spot the problem and find a fix. (Or maybe this is an issue with the Crystal language / compiler?)
I’m guessing this library isn’t used very much yet, since there isn’t a lot of activity in the GitHub issues. But should I be aware of any underlying reasons for the lack of popularity? Is it just because people don’t know about this library, or do people think it’s a bad practice to mock things like this?