diff --git a/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb b/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb index 81f0e011558..8ec9fc24b93 100644 --- a/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb +++ b/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb @@ -22,6 +22,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do let(:reset_trigger) { DiscourseNarrativeBot::TrackSelector.reset_trigger } before do + SiteSetting.queue_jobs = false SiteSetting.discourse_narrative_bot_enabled = true end diff --git a/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb b/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb index 03d550f18f2..31ce253ce06 100644 --- a/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb +++ b/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb @@ -24,6 +24,7 @@ describe DiscourseNarrativeBot::NewUserNarrative do let(:reset_trigger) { DiscourseNarrativeBot::TrackSelector.reset_trigger } before do + SiteSetting.queue_jobs = false SiteSetting.discourse_narrative_bot_enabled = true end diff --git a/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/track_selector_spec.rb b/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/track_selector_spec.rb index 5e7594a2e72..7f0effc9068 100644 --- a/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/track_selector_spec.rb +++ b/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/track_selector_spec.rb @@ -36,6 +36,10 @@ describe DiscourseNarrativeBot::TrackSelector do end_message.chomp end + before do + SiteSetting.queue_jobs = false + end + describe '#select' do context 'in a PM with discobot' do let(:first_post) { Fabricate(:post, user: discobot_user) } diff --git a/plugins/discourse-narrative-bot/spec/integration/discobot_welcome_post_spec.rb b/plugins/discourse-narrative-bot/spec/integration/discobot_welcome_post_spec.rb index 9ada964d7ab..f9087b74597 100644 --- a/plugins/discourse-narrative-bot/spec/integration/discobot_welcome_post_spec.rb +++ b/plugins/discourse-narrative-bot/spec/integration/discobot_welcome_post_spec.rb @@ -4,7 +4,6 @@ describe "Discobot welcome post" do let(:user) { Fabricate(:user) } before do - SiteSetting.queue_jobs = true SiteSetting.discourse_narrative_bot_enabled = true end diff --git a/plugins/discourse-narrative-bot/spec/user_spec.rb b/plugins/discourse-narrative-bot/spec/user_spec.rb index d0dba54a7ee..216e2d66fcc 100644 --- a/plugins/discourse-narrative-bot/spec/user_spec.rb +++ b/plugins/discourse-narrative-bot/spec/user_spec.rb @@ -5,6 +5,7 @@ describe User do let(:profile_page_url) { "#{Discourse.base_url}/users/#{user.username}" } before do + SiteSetting.queue_jobs = false SiteSetting.discourse_narrative_bot_enabled = true end @@ -78,7 +79,6 @@ describe User do describe 'when welcome message is configured to be delayed' do before do SiteSetting.discourse_narrative_bot_welcome_post_delay = 100 - SiteSetting.queue_jobs = true end it 'should delay the welcome post until user logs in' do diff --git a/spec/components/auth/github_authenticator_spec.rb b/spec/components/auth/github_authenticator_spec.rb index 011c440971b..17fff987cdf 100644 --- a/spec/components/auth/github_authenticator_spec.rb +++ b/spec/components/auth/github_authenticator_spec.rb @@ -207,8 +207,6 @@ describe Auth::GithubAuthenticator do describe 'avatar retrieval' do let(:job_klass) { Jobs::DownloadAvatarFromUrl } - before { SiteSetting.queue_jobs = true } - context 'when user has a custom avatar' do let(:user_avatar) { Fabricate(:user_avatar, custom_upload: Fabricate(:upload)) } let(:user_with_custom_avatar) { Fabricate(:user, user_avatar: user_avatar) } diff --git a/spec/components/email/receiver_spec.rb b/spec/components/email/receiver_spec.rb index d0d2048edc7..a6525afce8c 100644 --- a/spec/components/email/receiver_spec.rb +++ b/spec/components/email/receiver_spec.rb @@ -389,7 +389,6 @@ describe Email::Receiver do it "supports attached images in TEXT part" do SiteSetting.incoming_email_prefer_html = false - SiteSetting.queue_jobs = true expect { process(:no_body_with_image) }.to change { topic.posts.count } expect(topic.posts.last.raw).to match(/ embed_url } } + before do + SiteSetting.queue_jobs = false + end + after do expect(response).to be_success expect(response.headers['X-Frame-Options']).to eq("ALLOWALL") diff --git a/spec/requests/groups_controller_spec.rb b/spec/requests/groups_controller_spec.rb index 8a25aea5fd1..b268542391c 100644 --- a/spec/requests/groups_controller_spec.rb +++ b/spec/requests/groups_controller_spec.rb @@ -496,7 +496,6 @@ describe GroupsController do before do user.update_attributes!(admin: true) sign_in(user) - SiteSetting.queue_jobs = true end it 'should be able to update the group' do diff --git a/spec/requests/posts_controller_spec.rb b/spec/requests/posts_controller_spec.rb index 6ad5f32dd90..f43a5b511f5 100644 --- a/spec/requests/posts_controller_spec.rb +++ b/spec/requests/posts_controller_spec.rb @@ -568,6 +568,7 @@ describe PostsController do end it 'allows to create posts in import_mode' do + SiteSetting.queue_jobs = false NotificationEmailer.enable post_1 = Fabricate(:post) user = Fabricate(:user) @@ -782,8 +783,6 @@ describe PostsController do end it 'can create a reply to a post' do - SiteSetting.queue_jobs = true - topic = Fabricate(:private_message_post, user: user).topic post_2 = Fabricate(:private_message_post, user: user, topic: topic) diff --git a/spec/requests/session_controller_spec.rb b/spec/requests/session_controller_spec.rb index 3005b10a702..3dfb07c5833 100644 --- a/spec/requests/session_controller_spec.rb +++ b/spec/requests/session_controller_spec.rb @@ -435,7 +435,6 @@ RSpec.describe SessionController do end it 'sends an activation email' do - SiteSetting.queue_jobs = true sso = get_sso('/a/') sso.external_id = '666' # the number of the beast sso.email = 'bob@bob.com' @@ -1200,7 +1199,6 @@ RSpec.describe SessionController do context 'for a non existant username' do it "doesn't generate a new token for a made up username" do - SiteSetting.queue_jobs = true expect do post "/session/forgot_password.json", params: { login: 'made_up' } end.not_to change(EmailToken, :count) @@ -1238,7 +1236,6 @@ RSpec.describe SessionController do end it "enqueues an email" do - SiteSetting.queue_jobs = true post "/session/forgot_password.json", params: { login: user.username } expect(Jobs::CriticalUserEmail.jobs.size).to eq(1) end @@ -1254,7 +1251,6 @@ RSpec.describe SessionController do end it 'enqueues no email' do - SiteSetting.queue_jobs = true post "/session/forgot_password.json", params: { login: system.username } expect(Jobs::CriticalUserEmail.jobs.size).to eq(0) end @@ -1270,7 +1266,6 @@ RSpec.describe SessionController do end it 'enqueues no email' do - SiteSetting.queue_jobs = true post "/session/forgot_password.json", params: { login: staged.username } expect(Jobs::CriticalUserEmail.jobs.size).to eq(0) end diff --git a/spec/requests/topics_controller_spec.rb b/spec/requests/topics_controller_spec.rb index 64d11da2c43..3be410083cd 100644 --- a/spec/requests/topics_controller_spec.rb +++ b/spec/requests/topics_controller_spec.rb @@ -258,8 +258,6 @@ RSpec.describe TopicsController do describe 'publishing topic to category in the future' do it 'should be able to create the topic status update' do - SiteSetting.queue_jobs = true - post "/t/#{topic.id}/timer.json", params: { time: 24, status_type: TopicTimer.types[3], diff --git a/spec/requests/users_controller_spec.rb b/spec/requests/users_controller_spec.rb index 6712de39ac5..5b7e588c528 100644 --- a/spec/requests/users_controller_spec.rb +++ b/spec/requests/users_controller_spec.rb @@ -25,10 +25,6 @@ describe UsersController do context 'valid token' do context 'welcome message' do - before do - SiteSetting.queue_jobs = true - end - it 'enqueues a welcome message if the user object indicates so' do user.update(active: false) put "/u/activate-account/#{token}" @@ -353,7 +349,6 @@ describe UsersController do context 'enqueues mail' do it 'enqueues mail with admin email and sso enabled' do - SiteSetting.queue_jobs = true put "/u/admin-login", params: { email: admin.email } expect(response.status).to eq(200) expect(Jobs::CriticalUserEmail.jobs.size).to eq(1) @@ -469,8 +464,7 @@ describe UsersController do UsersController.any_instance.stubs(:honeypot_value).returns(nil) UsersController.any_instance.stubs(:challenge_value).returns(nil) SiteSetting.allow_new_registrations = true - @user = Fabricate.build(:user) - @user.password = "strongpassword" + @user = Fabricate.build(:user, password: "strongpassword") end let(:post_user_params) do @@ -524,8 +518,6 @@ describe UsersController do end it 'creates a user correctly' do - SiteSetting.queue_jobs = true - post_user expect(response.status).to eq(200) expect(JSON.parse(response.body)['active']).to be_falsey @@ -545,8 +537,6 @@ describe UsersController do before { SiteSetting.must_approve_users = true } it 'creates a user correctly' do - SiteSetting.queue_jobs = true - post_user expect(response.status).to eq(200) @@ -619,7 +609,6 @@ describe UsersController do let(:api_key) { Fabricate(:api_key, user: admin) } it "creates the user as active with a regular key" do - SiteSetting.queue_jobs = true SiteSetting.send_welcome_message = true SiteSetting.must_approve_users = true @@ -700,7 +689,6 @@ describe UsersController do before { User.any_instance.stubs(:active?).returns(true) } it 'enqueues a welcome email' do - SiteSetting.queue_jobs = true User.any_instance.expects(:enqueue_welcome_message).with('welcome_user') post_user @@ -1598,7 +1586,8 @@ describe UsersController do password: "strongpassword", email: "dsdsds@sasa.com" } - User.where(username: "osamatest").first + + User.find_by(username: "osamatest") end context 'for an existing user' do @@ -1698,10 +1687,12 @@ describe UsersController do end it 'should send an email' do - SiteSetting.queue_jobs = true - post "/u/action/send_activation_email.json", params: { username: user.username } + expect do + post "/u/action/send_activation_email.json", params: { + username: user.username + } + end.to change { Jobs::CriticalUserEmail.jobs.size }.by(1) - expect(Jobs::CriticalUserEmail.jobs.size).to eq(1) expect(session[SessionController::ACTIVATE_USER_KEY]).to eq(nil) end end @@ -1709,7 +1700,6 @@ describe UsersController do context 'when username does not exist' do it 'should not send an email' do - SiteSetting.queue_jobs = true post "/u/action/send_activation_email.json", params: { username: 'nopenopenopenope' } expect(response.status).to eq(404) expect(Jobs::CriticalUserEmail.jobs.size).to eq(0) @@ -2691,7 +2681,6 @@ describe UsersController do describe '#email_login' do before do - SiteSetting.queue_jobs = true SiteSetting.enable_local_logins_via_email = true end diff --git a/spec/services/group_mentions_updater_spec.rb b/spec/services/group_mentions_updater_spec.rb index 301fa134d50..7bdfce7cde3 100644 --- a/spec/services/group_mentions_updater_spec.rb +++ b/spec/services/group_mentions_updater_spec.rb @@ -3,6 +3,10 @@ require 'rails_helper' RSpec.describe GroupMentionsUpdater do let(:post) { Fabricate(:post) } + before do + SiteSetting.queue_jobs = false + end + describe '.update' do it 'should update valid group mentions' do new_group_name = 'awesome_team' diff --git a/spec/services/post_alerter_spec.rb b/spec/services/post_alerter_spec.rb index c7abefee984..87408d112f9 100644 --- a/spec/services/post_alerter_spec.rb +++ b/spec/services/post_alerter_spec.rb @@ -307,6 +307,10 @@ describe PostAlerter do let(:user) { post1.user } let(:linking_post) { create_post(raw: "my magic topic\n##{Discourse.base_url}#{post1.url}") } + before do + SiteSetting.queue_jobs = false + end + it "will notify correctly on linking" do linking_post @@ -379,6 +383,10 @@ describe PostAlerter do let(:mention_post) { create_post_with_alerts(user: user, raw: 'Hello @eviltrout') } let(:topic) { mention_post.topic } + before do + SiteSetting.queue_jobs = false + end + it 'notifies a user' do expect { mention_post @@ -629,7 +637,6 @@ describe PostAlerter do let(:topic) { mention_post.topic } it "pushes nothing to suspended users" do - SiteSetting.queue_jobs = true SiteSetting.allowed_user_api_push_urls = "https://site.com/push|https://site2.com/push" evil_trout.update_columns(suspended_till: 1.year.from_now) @@ -647,6 +654,7 @@ describe PostAlerter do end it "correctly pushes notifications if configured correctly" do + SiteSetting.queue_jobs = false SiteSetting.allowed_user_api_push_urls = "https://site.com/push|https://site2.com/push" 2.times do |i| diff --git a/spec/services/user_anonymizer_spec.rb b/spec/services/user_anonymizer_spec.rb index 58eefd90edf..f397bc930bb 100644 --- a/spec/services/user_anonymizer_spec.rb +++ b/spec/services/user_anonymizer_spec.rb @@ -120,6 +120,7 @@ describe UserAnonymizer do end it "updates the avatar in posts" do + SiteSetting.queue_jobs = false upload = Fabricate(:upload, user: user) user.user_avatar = UserAvatar.new(user_id: user.id, custom_upload_id: upload.id) user.uploaded_avatar_id = upload.id # chosen in user preferences diff --git a/spec/services/username_changer_spec.rb b/spec/services/username_changer_spec.rb index 15b41d5f8b2..87e5da2b0c9 100644 --- a/spec/services/username_changer_spec.rb +++ b/spec/services/username_changer_spec.rb @@ -1,6 +1,9 @@ require 'rails_helper' describe UsernameChanger do + before do + SiteSetting.queue_jobs = false + end describe '#change' do let(:user) { Fabricate(:user) }