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:
@@ -68,7 +68,7 @@ describe CategoryUser do
|
||||
|
||||
context 'integration' do
|
||||
before do
|
||||
SiteSetting.queue_jobs = false
|
||||
run_jobs_synchronously!
|
||||
NotificationEmailer.enable
|
||||
end
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ describe DiscourseSingleSignOn do
|
||||
SiteSetting.sso_url = @sso_url
|
||||
SiteSetting.enable_sso = true
|
||||
SiteSetting.sso_secret = @sso_secret
|
||||
SiteSetting.queue_jobs = false
|
||||
run_jobs_synchronously!
|
||||
end
|
||||
|
||||
def make_sso
|
||||
|
||||
@@ -1072,7 +1072,7 @@ describe PostAction do
|
||||
end
|
||||
|
||||
it "should create a notification in the related topic" do
|
||||
SiteSetting.queue_jobs = false
|
||||
run_jobs_synchronously!
|
||||
post = Fabricate(:post)
|
||||
user = Fabricate(:user)
|
||||
action = PostAction.act(user, post, PostActionType.types[:spam], message: "WAT")
|
||||
@@ -1089,7 +1089,7 @@ describe PostAction do
|
||||
end
|
||||
|
||||
it "should not add a moderator post when post is flagged via private message" do
|
||||
SiteSetting.queue_jobs = false
|
||||
run_jobs_synchronously!
|
||||
post = Fabricate(:post)
|
||||
user = Fabricate(:user)
|
||||
action = PostAction.act(user, post, PostActionType.types[:notify_user], message: "WAT")
|
||||
|
||||
@@ -41,7 +41,7 @@ describe PostMover do
|
||||
|
||||
before do
|
||||
SiteSetting.tagging_enabled = true
|
||||
SiteSetting.queue_jobs = false
|
||||
run_jobs_synchronously!
|
||||
p1.replies << p3
|
||||
p2.replies << p4
|
||||
UserActionCreator.enable
|
||||
@@ -570,7 +570,7 @@ describe PostMover do
|
||||
|
||||
before do
|
||||
SiteSetting.tagging_enabled = true
|
||||
SiteSetting.queue_jobs = false
|
||||
run_jobs_synchronously!
|
||||
p1.replies << p3
|
||||
p2.replies << p4
|
||||
UserActionCreator.enable
|
||||
|
||||
@@ -995,7 +995,7 @@ describe Post do
|
||||
end
|
||||
|
||||
before do
|
||||
SiteSetting.queue_jobs = false
|
||||
run_jobs_synchronously!
|
||||
end
|
||||
|
||||
describe 'when user can not mention a group' do
|
||||
|
||||
@@ -2,7 +2,7 @@ require 'rails_helper'
|
||||
|
||||
describe QuotedPost do
|
||||
it 'correctly extracts quotes' do
|
||||
SiteSetting.queue_jobs = false
|
||||
run_jobs_synchronously!
|
||||
|
||||
topic = Fabricate(:topic)
|
||||
post1 = create_post(topic: topic, post_number: 1, raw: "foo bar")
|
||||
@@ -34,7 +34,7 @@ describe QuotedPost do
|
||||
end
|
||||
|
||||
it "doesn't count quotes from the same post" do
|
||||
SiteSetting.queue_jobs = false
|
||||
run_jobs_synchronously!
|
||||
|
||||
topic = Fabricate(:topic)
|
||||
post = create_post(topic: topic, post_number: 1, raw: "foo bar")
|
||||
|
||||
@@ -75,7 +75,7 @@ describe TagUser do
|
||||
|
||||
context "with some tag notification settings" do
|
||||
before do
|
||||
SiteSetting.queue_jobs = false
|
||||
run_jobs_synchronously!
|
||||
end
|
||||
|
||||
let :watched_post do
|
||||
|
||||
@@ -1280,7 +1280,7 @@ describe Topic do
|
||||
|
||||
describe 'user that is watching the new category' do
|
||||
it 'should generate the notification for the topic' do
|
||||
SiteSetting.queue_jobs = false
|
||||
run_jobs_synchronously!
|
||||
|
||||
topic.posts << Fabricate(:post)
|
||||
|
||||
@@ -1602,7 +1602,7 @@ describe Topic do
|
||||
let(:topic) { Fabricate(:topic, category: category) }
|
||||
|
||||
it "should be able to override category's default auto close" do
|
||||
SiteSetting.queue_jobs = false
|
||||
run_jobs_synchronously!
|
||||
|
||||
expect(topic.topic_timers.first.duration).to eq(4)
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ RSpec.describe TopicTimer, type: :model do
|
||||
end
|
||||
|
||||
before do
|
||||
SiteSetting.queue_jobs = false
|
||||
run_jobs_synchronously!
|
||||
end
|
||||
|
||||
it 'should close the topic' do
|
||||
@@ -219,7 +219,7 @@ RSpec.describe TopicTimer, type: :model do
|
||||
end
|
||||
|
||||
before do
|
||||
SiteSetting.queue_jobs = false
|
||||
run_jobs_synchronously!
|
||||
end
|
||||
|
||||
it 'should open the topic' do
|
||||
|
||||
@@ -451,7 +451,7 @@ describe TopicUser do
|
||||
it "will receive email notification for every topic" do
|
||||
user1 = Fabricate(:user)
|
||||
|
||||
SiteSetting.queue_jobs = false
|
||||
run_jobs_synchronously!
|
||||
SiteSetting.default_email_mailing_list_mode = true
|
||||
SiteSetting.default_email_mailing_list_mode_frequency = 1
|
||||
|
||||
|
||||
@@ -1088,7 +1088,7 @@ describe User do
|
||||
|
||||
context "with a reply" do
|
||||
before do
|
||||
SiteSetting.queue_jobs = false
|
||||
run_jobs_synchronously!
|
||||
PostCreator.new(Fabricate(:user),
|
||||
raw: 'whatever this is a raw post',
|
||||
topic_id: topic.id,
|
||||
|
||||
Reference in New Issue
Block a user