mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Add new run_jobs_synchronously! helper for tests
Previously if you wanted to have jobs execute in test mode, you'd have to do `SiteSetting.queue_jobs = false`, because the opposite of queue is to execute. I found this very confusing, so I created a test helper called `run_jobs_synchronously!` which is much more clear about what it does.
This commit is contained in:
@@ -5,6 +5,12 @@ module Helpers
|
||||
@next_seq = (@next_seq || 0) + 1
|
||||
end
|
||||
|
||||
# If you don't `queue_jobs` it means you want to run them synchronously. This method
|
||||
# makes that more clear in tests. It is automatically reset after every test.
|
||||
def run_jobs_synchronously!
|
||||
SiteSetting.queue_jobs = false
|
||||
end
|
||||
|
||||
def log_in(fabricator = nil)
|
||||
user = Fabricate(fabricator || :user)
|
||||
log_in_user(user)
|
||||
|
||||
Reference in New Issue
Block a user