The provided matcher does not work when used with durations, such as 1.day. I even tried it with the original blog post code examples [1], and it failed there as well. Digging a little deeper, I noticed a particular call duration.to_i which casts the duration to seconds and then the subsequent filtering of the jobs returns an empty array.
duration_to_fetch = if duration.is_a?(String) || duration.is_a?(Symbol)
duration
else
duration
end
In my opinion one would not need this casting. Simply assume the duration in the code and the specs is the same.
[1] https://devpost.com/software/shoulda-matchers-for-whenever
The provided matcher does not work when used with durations, such as
1.day. I even tried it with the original blog post code examples [1], and it failed there as well. Digging a little deeper, I noticed a particular callduration.to_iwhich casts the duration to seconds and then the subsequent filtering of the jobs returns an empty array.In my opinion one would not need this casting. Simply assume the duration in the code and the specs is the same.
[1] https://devpost.com/software/shoulda-matchers-for-whenever