-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Add Active Job's assertions to ActiveSupport::TestCase #17475
Conversation
👍 |
Wait! That will break if AJ is not part of the bundle. eq(A project without AJ or AM) |
Yup, this is not ideal and this is why I didn't put it directly under |
Do we have |
Nope we don't plus we are adding |
This is not a concern, it has been decided that AJ will always be present in Rails apps. In a way, it's kind of like |
@@ -8,5 +8,8 @@ class ActiveSupport::TestCase | |||
fixtures :all | |||
|
|||
<% end -%> | |||
# Make Active Job's custom assertions available inside all tests | |||
include ActiveJob::TestHelper |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is the right place to add this. As mentioned in my comments above, this is not something that we expect people to turn off, so I don't think it makes sense to include it in a template. Seems like we can just do this automatically somewhere inside Active Job?
Since we should test job queuing/execution inside other components of the application like models and controllers, we should make the custom assertions provided by `ActiveJob::TestHelper` available directly from `ActiveSupport::TestCase`. Thus, we don't need the `ActiveJob::TestCase` class anymore so we can remove it and avoid relying on it when we generate a job's test.
Let's add tests to ensure that this generator get the works done when we are calling it along the lines of the other ones.
Ok, so I moved this directly to Active Job and addressed the discussion that we had on the Campfire room regarding the removal of The problem is that The real question is do we expect people to be able to use another queue adapter than If yes, then we would certainly need a kind of If no, then there's no big deal, this won't work anyway outside of the framework but apart from the aforementioned solution with Feel free to ask questions if something isn't clear in my explanations ! |
We can ship with apps mixing in |
@robin850 want to take back on this? If not we should close. |
@rafaelfranca : I'm closing this one ; maybe I will work on it later but I don't have much time to spend on it ATM, sorry ! :/ |
Hello,
Since we should test job queuing/execution inside other components of the application like models and controllers, we should make the custom assertions provided by
ActiveJob::TestHelper
available directly fromActiveSupport::TestCase
.Thus, we don't need the
ActiveJob::TestCase
class anymore so we can remove it and avoid relying on it when we generate a job's test.This has originally been requested here but it turns out that this hasn't been addressed.
Have a nice day.