Skip to content

Possible bug when handling durations #4

@why-el

Description

@why-el

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions