Conversation
spec/resque_spec/matchers_spec.rb
Outdated
| let(:scheduled_at) { Time.now + 30 * 60 } | ||
|
|
||
| before(:each) do | ||
| if [true, false].sample |
There was a problem hiding this comment.
Hi @JonaMX,
Thanks for the PR. Using sample in a spec is problematic as the spec is not deterministic from run to run. One alternative would be to extract the two examples into a shared group. Then run the shared group with enqueue_at and enqueue_in.
|
Hi @JonaMX, Made a comment on one of the files, but am wondering if this is a case of dropping down to more specific examples? The code under test must be choosing between |
|
Hi @leshill thanks for the feedback, I attended your comments. |
|
Hi @JonaMX, Thanks for updating the spec. On a similar note, instead of creating a new matcher, perhaps the same can be done in your app’s specs? For example, if the decision on whether to Does that make sense? |
I had to run some A/B testing on my project sending some emails at specific time and others at a specific interval, but then I ran into the issue of how to test this behavior on my specs, that's why I've created a new matcher
at_or_into test against both options eitherenqueue_atorenqueue_inmethod