Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support argument matchers in have_enqueued_* #2206

Merged
merged 1 commit into from Nov 21, 2019

Conversation

pirj
Copy link
Member

@pirj pirj commented Nov 10, 2019

Allows for:

have_enqueued_job.at(a_value_within(5.seconds).of(future))
have_enqueued_mail.at(a_value_within(5.seconds).of(future))

Fixes #2205

Time.at seems to be quite fine as per https://github.com/rails/rails/blob/a707072/activejob/lib/active_job/test_helper.rb#L679

@mkamensky I can backport to 3.9 if you like, or appreciate if you do so if this one change gets through.

@pirj pirj self-assigned this Nov 10, 2019
@glenpike
Copy link

glenpike commented Nov 14, 2019

Maybe a dumb question, but will this also support have_been_enqueued, e.g.

before do
  #in our before, we actually call AnotherJob.perform_now which calls the following:
  MyJob.set(wait: 7.days).perform_later('123')
end

it 'queues MyJob job' do
  expect(MyJob).to have_been_enqueued.exactly(:once).at(a_value_within(1.minute).of(7.days.from_now))
end

@pirj pirj force-pushed the composable-at-in-have_enqueued-matchers branch from 270afcc to 2022f55 Compare November 14, 2019 19:41
@pirj
Copy link
Member Author

pirj commented Nov 14, 2019

@glenpike Absolutely.
Added a spec for this.

@pirj pirj requested a review from JonRowe November 14, 2019 19:43
@JonRowe
Copy link
Member

JonRowe commented Nov 19, 2019

Looks good, would prefer it squashed into one commit, and can you add a change log either before or after merging :)

@pirj pirj force-pushed the composable-at-in-have_enqueued-matchers branch from c8e9cc0 to d132c47 Compare November 21, 2019 17:54
@pirj pirj changed the title Support composable matchers in have_enqueued_* Support argument matchers in have_enqueued_* Nov 21, 2019
Fixes #2205

Time.at seems to be quite fine as
pert://github.com/rails/rails/blob/a707072/activejob/lib/active_job/test_helper.rb#L679
@pirj pirj force-pushed the composable-at-in-have_enqueued-matchers branch from d132c47 to b1e27e2 Compare November 21, 2019 18:00
@pirj
Copy link
Member Author

pirj commented Nov 21, 2019

Changelog item added, squashed commits. Forgot to force-push, this pull request almost slipped my mind.

@pirj pirj merged commit d0f81df into master Nov 21, 2019
@pirj pirj deleted the composable-at-in-have_enqueued-matchers branch November 21, 2019 19:02
JonRowe pushed a commit that referenced this pull request Jan 12, 2020
…tchers

Support argument matchers in have_enqueued_*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

approximate at for activejob
3 participants