-
Notifications
You must be signed in to change notification settings - Fork 157
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
inline doesnt work for RSpec #526
Comments
Hey @brentgreeff, Solid Queue doesn't support the test environment out of the box. Rails, however, includes a test adapter ( |
Thanks @rosa but I understand all of that. How it should work is that
"asserting about which jobs are enqueued and with which arguments" - this is exactly the opposite of a "behavioural" test - thats a unit-test. I will simply have to add "Solid Queue doesn't support the test environment" - thats exactly the problem - it should - testing is fundamental to rails development. |
Hey @brentgreeff, understood, but if you want a job scheduled in the future to run immediately in your tests, you're also not testing the real behaviour.
Not really, because you'd also perform the jobs. This helps you with things like the scheduled time, which you wouldn't be able to test in any other way since you can't wait 30 minutes in your test. Then, you can also make sure the jobs are executed as they would in production, and also ensure the scheduled time is the one you expect.
Rails has a test adapter precisely for this. |
Testing the schedule time - is not behavioural testing. That is testing a configuration detail. Why on earth would someone write a test for that - its pedantic. I already have a solution - thank you. |
You probably wouldn't write it for |
solid_queue (1.1.3)
&rails 8.0.1
.I had
config.active_job.queue_adapter = :solid_queue
set forconfig/environments/test.rb
but this meant that job code was not executed inside tests.
By that I mean - I have request specs - which
peform_later
- but my job code is then not exercised by the test.I changed to
config.active_job.queue_adapter = :inline
which means my jobs are executed in tests - which is what I want, but then if I use:.set(wait: 30.minutes).perform_later(self.id)
This is annoying.
I was using good_job before this for 3 years and I dont remember an issue like this.
Is it my imagination or did DHH say something about preferring integration testing?
That its better to test behaviour broadly, instead of little islands of functionality.
I also use
capybara-email
gem for system_specs. - I haven't tried it with solidQ yet, but that would be a deal-breaker if I cant get it working.The text was updated successfully, but these errors were encountered: