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:
parent
2ee02cb6c7
commit
d1d9a4f128
@ -2,7 +2,7 @@ require 'rails_helper'
|
|||||||
|
|
||||||
describe <%= name %>::ActionsController do
|
describe <%= name %>::ActionsController do
|
||||||
before do
|
before do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'can list' do
|
it 'can list' do
|
||||||
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
|||||||
describe Post do
|
describe Post do
|
||||||
|
|
||||||
before do
|
before do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#local_dates' do
|
describe '#local_dates' do
|
||||||
|
@ -22,7 +22,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
|
|||||||
let(:reset_trigger) { DiscourseNarrativeBot::TrackSelector.reset_trigger }
|
let(:reset_trigger) { DiscourseNarrativeBot::TrackSelector.reset_trigger }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
SiteSetting.discourse_narrative_bot_enabled = true
|
SiteSetting.discourse_narrative_bot_enabled = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||||||
let(:reset_trigger) { DiscourseNarrativeBot::TrackSelector.reset_trigger }
|
let(:reset_trigger) { DiscourseNarrativeBot::TrackSelector.reset_trigger }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
SiteSetting.discourse_narrative_bot_enabled = true
|
SiteSetting.discourse_narrative_bot_enabled = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ describe DiscourseNarrativeBot::TrackSelector do
|
|||||||
end
|
end
|
||||||
|
|
||||||
before do
|
before do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#select' do
|
describe '#select' do
|
||||||
|
@ -13,7 +13,7 @@ describe User do
|
|||||||
end
|
end
|
||||||
|
|
||||||
before do
|
before do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
SiteSetting.discourse_narrative_bot_enabled = true
|
SiteSetting.discourse_narrative_bot_enabled = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -902,7 +902,7 @@ describe PostCreator do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'can post to a group correctly' do
|
it 'can post to a group correctly' do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
|
|
||||||
expect(post.topic.archetype).to eq(Archetype.private_message)
|
expect(post.topic.archetype).to eq(Archetype.private_message)
|
||||||
expect(post.topic.topic_allowed_users.count).to eq(1)
|
expect(post.topic.topic_allowed_users.count).to eq(1)
|
||||||
|
@ -617,7 +617,7 @@ describe PostDestroyer do
|
|||||||
|
|
||||||
context '@mentions' do
|
context '@mentions' do
|
||||||
it 'removes notifications when deleted' do
|
it 'removes notifications when deleted' do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
user = Fabricate(:evil_trout)
|
user = Fabricate(:evil_trout)
|
||||||
post = create_post(raw: 'Hello @eviltrout')
|
post = create_post(raw: 'Hello @eviltrout')
|
||||||
expect {
|
expect {
|
||||||
|
@ -608,7 +608,7 @@ describe PostRevisor do
|
|||||||
let(:mentioned_user) { Fabricate(:user) }
|
let(:mentioned_user) { Fabricate(:user) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
end
|
end
|
||||||
|
|
||||||
it "generates a notification for a mention" do
|
it "generates a notification for a mention" do
|
||||||
|
@ -163,7 +163,7 @@ describe WatchedWord do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "flags on revisions" do
|
it "flags on revisions" do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
post = Fabricate(:post, topic: Fabricate(:topic, user: tl2_user), user: tl2_user)
|
post = Fabricate(:post, topic: Fabricate(:topic, user: tl2_user), user: tl2_user)
|
||||||
expect {
|
expect {
|
||||||
PostRevisor.new(post).revise!(post.user, { raw: "Want some #{flag_word.word} for cheap?" }, revised_at: post.updated_at + 10.seconds)
|
PostRevisor.new(post).revise!(post.user, { raw: "Want some #{flag_word.word} for cheap?" }, revised_at: post.updated_at + 10.seconds)
|
||||||
|
@ -32,7 +32,7 @@ describe Jobs::PullHotlinkedImages do
|
|||||||
|
|
||||||
describe '#execute' do
|
describe '#execute' do
|
||||||
before do
|
before do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
FastImage.expects(:size).returns([100, 100]).at_least_once
|
FastImage.expects(:size).returns([100, 100]).at_least_once
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ RSpec.describe UploadRecovery do
|
|||||||
|
|
||||||
before do
|
before do
|
||||||
SiteSetting.authorized_extensions = 'png|pdf'
|
SiteSetting.authorized_extensions = 'png|pdf'
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
end
|
end
|
||||||
|
|
||||||
after do
|
after do
|
||||||
|
@ -68,7 +68,7 @@ describe CategoryUser do
|
|||||||
|
|
||||||
context 'integration' do
|
context 'integration' do
|
||||||
before do
|
before do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
NotificationEmailer.enable
|
NotificationEmailer.enable
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ describe DiscourseSingleSignOn do
|
|||||||
SiteSetting.sso_url = @sso_url
|
SiteSetting.sso_url = @sso_url
|
||||||
SiteSetting.enable_sso = true
|
SiteSetting.enable_sso = true
|
||||||
SiteSetting.sso_secret = @sso_secret
|
SiteSetting.sso_secret = @sso_secret
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
end
|
end
|
||||||
|
|
||||||
def make_sso
|
def make_sso
|
||||||
|
@ -1072,7 +1072,7 @@ describe PostAction do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "should create a notification in the related topic" do
|
it "should create a notification in the related topic" do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
post = Fabricate(:post)
|
post = Fabricate(:post)
|
||||||
user = Fabricate(:user)
|
user = Fabricate(:user)
|
||||||
action = PostAction.act(user, post, PostActionType.types[:spam], message: "WAT")
|
action = PostAction.act(user, post, PostActionType.types[:spam], message: "WAT")
|
||||||
@ -1089,7 +1089,7 @@ describe PostAction do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "should not add a moderator post when post is flagged via private message" do
|
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)
|
post = Fabricate(:post)
|
||||||
user = Fabricate(:user)
|
user = Fabricate(:user)
|
||||||
action = PostAction.act(user, post, PostActionType.types[:notify_user], message: "WAT")
|
action = PostAction.act(user, post, PostActionType.types[:notify_user], message: "WAT")
|
||||||
|
@ -41,7 +41,7 @@ describe PostMover do
|
|||||||
|
|
||||||
before do
|
before do
|
||||||
SiteSetting.tagging_enabled = true
|
SiteSetting.tagging_enabled = true
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
p1.replies << p3
|
p1.replies << p3
|
||||||
p2.replies << p4
|
p2.replies << p4
|
||||||
UserActionCreator.enable
|
UserActionCreator.enable
|
||||||
@ -570,7 +570,7 @@ describe PostMover do
|
|||||||
|
|
||||||
before do
|
before do
|
||||||
SiteSetting.tagging_enabled = true
|
SiteSetting.tagging_enabled = true
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
p1.replies << p3
|
p1.replies << p3
|
||||||
p2.replies << p4
|
p2.replies << p4
|
||||||
UserActionCreator.enable
|
UserActionCreator.enable
|
||||||
|
@ -995,7 +995,7 @@ describe Post do
|
|||||||
end
|
end
|
||||||
|
|
||||||
before do
|
before do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'when user can not mention a group' do
|
describe 'when user can not mention a group' do
|
||||||
|
@ -2,7 +2,7 @@ require 'rails_helper'
|
|||||||
|
|
||||||
describe QuotedPost do
|
describe QuotedPost do
|
||||||
it 'correctly extracts quotes' do
|
it 'correctly extracts quotes' do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
|
|
||||||
topic = Fabricate(:topic)
|
topic = Fabricate(:topic)
|
||||||
post1 = create_post(topic: topic, post_number: 1, raw: "foo bar")
|
post1 = create_post(topic: topic, post_number: 1, raw: "foo bar")
|
||||||
@ -34,7 +34,7 @@ describe QuotedPost do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "doesn't count quotes from the same post" do
|
it "doesn't count quotes from the same post" do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
|
|
||||||
topic = Fabricate(:topic)
|
topic = Fabricate(:topic)
|
||||||
post = create_post(topic: topic, post_number: 1, raw: "foo bar")
|
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
|
context "with some tag notification settings" do
|
||||||
before do
|
before do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
end
|
end
|
||||||
|
|
||||||
let :watched_post do
|
let :watched_post do
|
||||||
|
@ -1280,7 +1280,7 @@ describe Topic do
|
|||||||
|
|
||||||
describe 'user that is watching the new category' do
|
describe 'user that is watching the new category' do
|
||||||
it 'should generate the notification for the topic' do
|
it 'should generate the notification for the topic' do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
|
|
||||||
topic.posts << Fabricate(:post)
|
topic.posts << Fabricate(:post)
|
||||||
|
|
||||||
@ -1602,7 +1602,7 @@ describe Topic do
|
|||||||
let(:topic) { Fabricate(:topic, category: category) }
|
let(:topic) { Fabricate(:topic, category: category) }
|
||||||
|
|
||||||
it "should be able to override category's default auto close" do
|
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)
|
expect(topic.topic_timers.first.duration).to eq(4)
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ RSpec.describe TopicTimer, type: :model do
|
|||||||
end
|
end
|
||||||
|
|
||||||
before do
|
before do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should close the topic' do
|
it 'should close the topic' do
|
||||||
@ -219,7 +219,7 @@ RSpec.describe TopicTimer, type: :model do
|
|||||||
end
|
end
|
||||||
|
|
||||||
before do
|
before do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should open the topic' do
|
it 'should open the topic' do
|
||||||
|
@ -451,7 +451,7 @@ describe TopicUser do
|
|||||||
it "will receive email notification for every topic" do
|
it "will receive email notification for every topic" do
|
||||||
user1 = Fabricate(:user)
|
user1 = Fabricate(:user)
|
||||||
|
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
SiteSetting.default_email_mailing_list_mode = true
|
SiteSetting.default_email_mailing_list_mode = true
|
||||||
SiteSetting.default_email_mailing_list_mode_frequency = 1
|
SiteSetting.default_email_mailing_list_mode_frequency = 1
|
||||||
|
|
||||||
|
@ -1088,7 +1088,7 @@ describe User do
|
|||||||
|
|
||||||
context "with a reply" do
|
context "with a reply" do
|
||||||
before do
|
before do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
PostCreator.new(Fabricate(:user),
|
PostCreator.new(Fabricate(:user),
|
||||||
raw: 'whatever this is a raw post',
|
raw: 'whatever this is a raw post',
|
||||||
topic_id: topic.id,
|
topic_id: topic.id,
|
||||||
|
@ -37,7 +37,7 @@ RSpec.describe Admin::FlagsController do
|
|||||||
|
|
||||||
context '#agree' do
|
context '#agree' do
|
||||||
it 'should raise a reasonable error if a flag was deferred and then someone else agreed' do
|
it 'should raise a reasonable error if a flag was deferred and then someone else agreed' do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
|
|
||||||
_post_action = PostAction.act(user, post_1, PostActionType.types[:spam], message: 'bad')
|
_post_action = PostAction.act(user, post_1, PostActionType.types[:spam], message: 'bad')
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ RSpec.describe Admin::FlagsController do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'should be able to agree and keep content' do
|
it 'should be able to agree and keep content' do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
|
|
||||||
post_action = PostAction.act(user, post_1, PostActionType.types[:spam], message: 'bad')
|
post_action = PostAction.act(user, post_1, PostActionType.types[:spam], message: 'bad')
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ RSpec.describe Admin::FlagsController do
|
|||||||
|
|
||||||
it 'should be able to hide spam' do
|
it 'should be able to hide spam' do
|
||||||
SiteSetting.allow_user_locale = true
|
SiteSetting.allow_user_locale = true
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
|
|
||||||
post_action = PostAction.act(user, post_1, PostActionType.types[:spam], message: 'bad')
|
post_action = PostAction.act(user, post_1, PostActionType.types[:spam], message: 'bad')
|
||||||
admin.update!(locale: 'ja')
|
admin.update!(locale: 'ja')
|
||||||
@ -90,7 +90,7 @@ RSpec.describe Admin::FlagsController do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'should not delete category topic' do
|
it 'should not delete category topic' do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
category.update_column(:topic_id, first_post.topic_id)
|
category.update_column(:topic_id, first_post.topic_id)
|
||||||
|
|
||||||
PostAction.act(user, first_post, PostActionType.types[:spam], message: 'bad')
|
PostAction.act(user, first_post, PostActionType.types[:spam], message: 'bad')
|
||||||
|
@ -78,7 +78,7 @@ RSpec.describe Admin::GroupsController do
|
|||||||
let(:user2) { Fabricate(:user, trust_level: 4) }
|
let(:user2) { Fabricate(:user, trust_level: 4) }
|
||||||
|
|
||||||
it "can assign users to a group by email or username" do
|
it "can assign users to a group by email or username" do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
|
|
||||||
put "/admin/groups/bulk.json", params: {
|
put "/admin/groups/bulk.json", params: {
|
||||||
group_id: group.id, users: [user.username.upcase, user2.email, 'doesnt_exist']
|
group_id: group.id, users: [user.username.upcase, user2.email, 'doesnt_exist']
|
||||||
|
@ -78,7 +78,7 @@ describe CategoriesController do
|
|||||||
|
|
||||||
describe "logged in" do
|
describe "logged in" do
|
||||||
before do
|
before do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
sign_in(admin)
|
sign_in(admin)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -226,7 +226,7 @@ describe CategoriesController do
|
|||||||
|
|
||||||
context '#update' do
|
context '#update' do
|
||||||
before do
|
before do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
end
|
end
|
||||||
|
|
||||||
it "requires the user to be logged in" do
|
it "requires the user to be logged in" do
|
||||||
|
@ -74,7 +74,7 @@ describe EmbedController do
|
|||||||
let(:headers) { { 'REFERER' => embed_url } }
|
let(:headers) { { 'REFERER' => embed_url } }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
end
|
end
|
||||||
|
|
||||||
it "raises an error with no referer" do
|
it "raises an error with no referer" do
|
||||||
|
@ -730,7 +730,7 @@ describe PostsController do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'allows to create posts in import_mode' do
|
it 'allows to create posts in import_mode' do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
NotificationEmailer.enable
|
NotificationEmailer.enable
|
||||||
post_1 = Fabricate(:post)
|
post_1 = Fabricate(:post)
|
||||||
user = Fabricate(:user)
|
user = Fabricate(:user)
|
||||||
|
@ -4,7 +4,7 @@ RSpec.describe GroupMentionsUpdater do
|
|||||||
let(:post) { Fabricate(:post) }
|
let(:post) { Fabricate(:post) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.update' do
|
describe '.update' do
|
||||||
|
@ -213,7 +213,7 @@ describe PostAlerter do
|
|||||||
let(:linking_post) { create_post(raw: "my magic topic\n##{Discourse.base_url}#{post1.url}") }
|
let(:linking_post) { create_post(raw: "my magic topic\n##{Discourse.base_url}#{post1.url}") }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
end
|
end
|
||||||
|
|
||||||
it "will notify correctly on linking" do
|
it "will notify correctly on linking" do
|
||||||
@ -289,7 +289,7 @@ describe PostAlerter do
|
|||||||
let(:topic) { mention_post.topic }
|
let(:topic) { mention_post.topic }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'notifies a user' do
|
it 'notifies a user' do
|
||||||
@ -591,7 +591,7 @@ describe PostAlerter do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "correctly pushes notifications if configured correctly" do
|
it "correctly pushes notifications if configured correctly" do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
SiteSetting.allowed_user_api_push_urls = "https://site.com/push|https://site2.com/push"
|
SiteSetting.allowed_user_api_push_urls = "https://site.com/push|https://site2.com/push"
|
||||||
|
|
||||||
2.times do |i|
|
2.times do |i|
|
||||||
|
@ -136,7 +136,7 @@ describe UserAnonymizer do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "updates the avatar in posts" do
|
it "updates the avatar in posts" do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
upload = Fabricate(:upload, user: user)
|
upload = Fabricate(:upload, user: user)
|
||||||
user.user_avatar = UserAvatar.new(user_id: user.id, custom_upload_id: upload.id)
|
user.user_avatar = UserAvatar.new(user_id: user.id, custom_upload_id: upload.id)
|
||||||
user.uploaded_avatar_id = upload.id # chosen in user preferences
|
user.uploaded_avatar_id = upload.id # chosen in user preferences
|
||||||
@ -214,7 +214,7 @@ describe UserAnonymizer do
|
|||||||
|
|
||||||
context "executes job" do
|
context "executes job" do
|
||||||
before do
|
before do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
end
|
end
|
||||||
|
|
||||||
it "removes invites" do
|
it "removes invites" do
|
||||||
@ -302,7 +302,7 @@ describe UserAnonymizer do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "exhaustively replaces all user ips" do
|
it "exhaustively replaces all user ips" do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
link = IncomingLink.create!(current_user_id: user.id, ip_address: old_ip, post_id: post.id)
|
link = IncomingLink.create!(current_user_id: user.id, ip_address: old_ip, post_id: post.id)
|
||||||
|
|
||||||
screened_email = ScreenedEmail.create!(email: user.email, ip_address: old_ip)
|
screened_email = ScreenedEmail.create!(email: user.email, ip_address: old_ip)
|
||||||
|
@ -2,7 +2,7 @@ require 'rails_helper'
|
|||||||
|
|
||||||
describe UsernameChanger do
|
describe UsernameChanger do
|
||||||
before do
|
before do
|
||||||
SiteSetting.queue_jobs = false
|
run_jobs_synchronously!
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#change' do
|
describe '#change' do
|
||||||
|
@ -5,6 +5,12 @@ module Helpers
|
|||||||
@next_seq = (@next_seq || 0) + 1
|
@next_seq = (@next_seq || 0) + 1
|
||||||
end
|
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)
|
def log_in(fabricator = nil)
|
||||||
user = Fabricate(fabricator || :user)
|
user = Fabricate(fabricator || :user)
|
||||||
log_in_user(user)
|
log_in_user(user)
|
||||||
|
Loading…
Reference in New Issue
Block a user