Testing Controllers that call an activejob
My integration tests hit a create method in my API that calls an activejob. This works fine in the actual app, but when I run any tests I get:
NameError: uninitialized constant Api::V1::ControllerName::JobName
Do I need to mock out the ActiveJob API or do load ActiveJob inside my
Maybe you just forgot to change
uninitialized constant Api::V1::ControllerName::JobName to match your class name?
Thanks - I'm just calling
Which raises the NameError. If I run it from the application UI it works fine, it's only when running from the test suite that it throws the NameError
Yeah, which is why my guess is that your test suite is referencing the wrong thing somewhere when it's trying to replicate the same thing.
Thanks. I made no changes to my codebase, but updated my mac which forced a restart of everything and now the tests pass without issue. I can only think that it was related to this Sidekiq issue: