DEV: Take 2 Queue jobs in tests by default.
On my machine this cuts the time taken to run our test suite from ~11mins to ~9mins.
This commit is contained in:
parent
56e9ff6853
commit
7fc8a36529
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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) }
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) }
|
||||
|
|
|
@ -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(/<img/)
|
||||
|
@ -399,7 +398,6 @@ describe Email::Receiver do
|
|||
end
|
||||
|
||||
it "supports attached images in HTML part" do
|
||||
SiteSetting.queue_jobs = true
|
||||
SiteSetting.incoming_email_prefer_html = true
|
||||
|
||||
expect { process(:inline_image) }.to change { topic.posts.count }
|
||||
|
|
|
@ -266,7 +266,6 @@ describe PostCreator do
|
|||
it 'creates a post with featured link' do
|
||||
SiteSetting.topic_featured_link_enabled = true
|
||||
SiteSetting.min_first_post_length = 100
|
||||
SiteSetting.queue_jobs = true
|
||||
|
||||
post = creator_with_featured_link.create
|
||||
expect(post.topic.featured_link).to eq('http://www.discourse.org')
|
||||
|
@ -290,10 +289,6 @@ describe PostCreator do
|
|||
end
|
||||
|
||||
describe "topic's auto close" do
|
||||
before do
|
||||
SiteSetting.queue_jobs = true
|
||||
end
|
||||
|
||||
it "doesn't update topic's auto close when it's not based on last post" do
|
||||
freeze_time
|
||||
|
||||
|
@ -838,6 +833,8 @@ describe PostCreator do
|
|||
end
|
||||
|
||||
it 'can post to a group correctly' do
|
||||
SiteSetting.queue_jobs = false
|
||||
|
||||
expect(post.topic.archetype).to eq(Archetype.private_message)
|
||||
expect(post.topic.topic_allowed_users.count).to eq(1)
|
||||
expect(post.topic.topic_allowed_groups.count).to eq(1)
|
||||
|
|
|
@ -521,6 +521,7 @@ describe PostDestroyer do
|
|||
|
||||
context '@mentions' do
|
||||
it 'removes notifications when deleted' do
|
||||
SiteSetting.queue_jobs = false
|
||||
user = Fabricate(:evil_trout)
|
||||
post = create_post(raw: 'Hello @eviltrout')
|
||||
expect {
|
||||
|
|
|
@ -570,6 +570,10 @@ describe PostRevisor do
|
|||
|
||||
let(:mentioned_user) { Fabricate(:user) }
|
||||
|
||||
before do
|
||||
SiteSetting.queue_jobs = false
|
||||
end
|
||||
|
||||
it "generates a notification for a mention" do
|
||||
expect {
|
||||
subject.revise!(Fabricate(:user), raw: "Random user is mentioning @#{mentioned_user.username_lower}")
|
||||
|
|
|
@ -83,7 +83,6 @@ describe Admin::EmailController do
|
|||
context '#handle_mail' do
|
||||
before do
|
||||
log_in_user(Fabricate(:admin))
|
||||
SiteSetting.queue_jobs = true
|
||||
end
|
||||
|
||||
it 'should enqueue the right job' do
|
||||
|
|
|
@ -10,6 +10,7 @@ describe CategoriesController do
|
|||
|
||||
describe "logged in" do
|
||||
before do
|
||||
SiteSetting.queue_jobs = false
|
||||
@user = log_in(:admin)
|
||||
end
|
||||
|
||||
|
@ -49,8 +50,6 @@ describe CategoriesController do
|
|||
}, format: :json
|
||||
end
|
||||
|
||||
it { is_expected.not_to respond_with(:success) }
|
||||
|
||||
it "returns errors on a duplicate category name" do
|
||||
expect(response.status).to eq(422)
|
||||
end
|
||||
|
@ -157,6 +156,9 @@ describe CategoriesController do
|
|||
end
|
||||
|
||||
describe "update" do
|
||||
before do
|
||||
SiteSetting.queue_jobs = false
|
||||
end
|
||||
|
||||
it "requires the user to be logged in" do
|
||||
put :update, params: { id: 'category' }, format: :json
|
||||
|
|
|
@ -28,7 +28,6 @@ describe Topic do
|
|||
|
||||
context 'jobs may be queued' do
|
||||
before do
|
||||
SiteSetting.queue_jobs = true
|
||||
freeze_time
|
||||
end
|
||||
|
||||
|
|
|
@ -163,6 +163,7 @@ describe WatchedWord do
|
|||
end
|
||||
|
||||
it "flags on revisions" do
|
||||
SiteSetting.queue_jobs = false
|
||||
post = Fabricate(:post, topic: Fabricate(:topic, user: tl2_user), user: tl2_user)
|
||||
expect {
|
||||
PostRevisor.new(post).revise!(post.user, { raw: "Want some #{flag_word.word} for cheap?" }, revised_at: post.updated_at + 10.seconds)
|
||||
|
|
|
@ -9,10 +9,6 @@ describe Jobs::DeleteTopic do
|
|||
|
||||
let(:first_post) { create_post(topic: topic) }
|
||||
|
||||
before do
|
||||
SiteSetting.queue_jobs = true
|
||||
end
|
||||
|
||||
it "can delete a topic" do
|
||||
first_post
|
||||
|
||||
|
|
|
@ -76,8 +76,6 @@ describe Jobs do
|
|||
end
|
||||
|
||||
it 'deletes the matching job' do
|
||||
SiteSetting.queue_jobs = true
|
||||
|
||||
Sidekiq::Testing.disable! do
|
||||
expect(scheduled_jobs.size).to eq(0)
|
||||
|
||||
|
|
|
@ -16,10 +16,6 @@ RSpec.describe Jobs::PublishTopicToCategory do
|
|||
topic
|
||||
end
|
||||
|
||||
before do
|
||||
SiteSetting.queue_jobs = true
|
||||
end
|
||||
|
||||
describe 'when topic has been deleted' do
|
||||
it 'should not publish the topic to the new category' do
|
||||
freeze_time 1.hour.ago
|
||||
|
|
|
@ -32,6 +32,7 @@ describe Jobs::PullHotlinkedImages do
|
|||
|
||||
describe '#execute' do
|
||||
before do
|
||||
SiteSetting.queue_jobs = false
|
||||
FastImage.expects(:size).returns([100, 100]).at_least_once
|
||||
end
|
||||
|
||||
|
|
|
@ -7,10 +7,6 @@ describe Jobs::ToggleTopicClosed do
|
|||
Fabricate(:topic_timer, user: admin).topic
|
||||
end
|
||||
|
||||
before do
|
||||
SiteSetting.queue_jobs = true
|
||||
end
|
||||
|
||||
it 'should be able to close a topic' do
|
||||
topic
|
||||
|
||||
|
|
|
@ -10,10 +10,6 @@ describe Jobs::TopicReminder do
|
|||
).topic
|
||||
end
|
||||
|
||||
before do
|
||||
SiteSetting.queue_jobs = true
|
||||
end
|
||||
|
||||
it "should be able to create a reminder" do
|
||||
topic_timer = topic.topic_timers.first
|
||||
freeze_time 1.day.from_now
|
||||
|
|
|
@ -68,6 +68,7 @@ describe CategoryUser do
|
|||
|
||||
context 'integration' do
|
||||
before do
|
||||
SiteSetting.queue_jobs = false
|
||||
NotificationEmailer.enable
|
||||
end
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ describe DiscourseSingleSignOn do
|
|||
SiteSetting.sso_url = @sso_url
|
||||
SiteSetting.enable_sso = true
|
||||
SiteSetting.sso_secret = @sso_secret
|
||||
SiteSetting.queue_jobs = false
|
||||
end
|
||||
|
||||
def make_sso
|
||||
|
|
|
@ -429,7 +429,6 @@ describe PostAction do
|
|||
post = create_post
|
||||
walterwhite = Fabricate(:walter_white)
|
||||
|
||||
SiteSetting.queue_jobs = true
|
||||
SiteSetting.flags_required_to_hide_post = 2
|
||||
Discourse.stubs(:site_contact_user).returns(admin)
|
||||
|
||||
|
@ -658,6 +657,7 @@ describe PostAction do
|
|||
end
|
||||
|
||||
it "should create a notification in the related topic" do
|
||||
SiteSetting.queue_jobs = false
|
||||
post = Fabricate(:post)
|
||||
user = Fabricate(:user)
|
||||
action = PostAction.act(user, post, PostActionType.types[:spam], message: "WAT")
|
||||
|
|
|
@ -39,6 +39,7 @@ describe PostMover do
|
|||
let(:p6) { Fabricate(:post, topic: topic) }
|
||||
|
||||
before do
|
||||
SiteSetting.queue_jobs = false
|
||||
p1.replies << p3
|
||||
p2.replies << p4
|
||||
UserActionCreator.enable
|
||||
|
|
|
@ -2,6 +2,8 @@ require 'rails_helper'
|
|||
|
||||
describe QuotedPost do
|
||||
it 'correctly extracts quotes' do
|
||||
SiteSetting.queue_jobs = false
|
||||
|
||||
topic = Fabricate(:topic)
|
||||
post1 = create_post(topic: topic, post_number: 1, raw: "foo bar")
|
||||
post2 = create_post(topic: topic, post_number: 2, raw: "lorem ipsum")
|
||||
|
|
|
@ -74,6 +74,9 @@ describe TagUser do
|
|||
let(:tracked_tag) { Fabricate(:tag) }
|
||||
|
||||
context "with some tag notification settings" do
|
||||
before do
|
||||
SiteSetting.queue_jobs = false
|
||||
end
|
||||
|
||||
let :watched_post do
|
||||
TagUser.create!(user: user, tag: watched_tag, notification_level: TagUser.notification_levels[:watching])
|
||||
|
|
|
@ -1214,6 +1214,8 @@ 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
|
||||
|
||||
topic.posts << Fabricate(:post)
|
||||
|
||||
CategoryUser.set_notification_level_for_category(
|
||||
|
@ -1269,7 +1271,6 @@ describe Topic do
|
|||
|
||||
describe 'when topic is already closed' do
|
||||
before do
|
||||
SiteSetting.queue_jobs = true
|
||||
topic.update_status('closed', true, Discourse.system_user)
|
||||
end
|
||||
|
||||
|
@ -1519,6 +1520,8 @@ 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
|
||||
|
||||
expect(topic.topic_timers.first.duration).to eq(4)
|
||||
|
||||
topic.set_or_create_timer(TopicTimer.types[:close], 2, by_user: admin)
|
||||
|
|
|
@ -176,6 +176,10 @@ RSpec.describe TopicTimer, type: :model do
|
|||
)
|
||||
end
|
||||
|
||||
before do
|
||||
SiteSetting.queue_jobs = false
|
||||
end
|
||||
|
||||
it 'should close the topic' do
|
||||
topic_timer
|
||||
expect(topic.reload.closed).to eq(true)
|
||||
|
@ -201,6 +205,10 @@ RSpec.describe TopicTimer, type: :model do
|
|||
)
|
||||
end
|
||||
|
||||
before do
|
||||
SiteSetting.queue_jobs = false
|
||||
end
|
||||
|
||||
it 'should open the topic' do
|
||||
topic_timer
|
||||
expect(topic.reload.closed).to eq(false)
|
||||
|
@ -239,10 +247,6 @@ RSpec.describe TopicTimer, type: :model do
|
|||
end
|
||||
|
||||
describe '.ensure_consistency!' do
|
||||
before do
|
||||
SiteSetting.queue_jobs = true
|
||||
end
|
||||
|
||||
it 'should enqueue jobs that have been missed' do
|
||||
close_topic_timer = Fabricate(:topic_timer,
|
||||
execute_at: Time.zone.now - 1.hour,
|
||||
|
|
|
@ -437,6 +437,7 @@ describe TopicUser do
|
|||
it "will receive email notification for every topic" do
|
||||
user1 = Fabricate(:user)
|
||||
|
||||
SiteSetting.queue_jobs = false
|
||||
SiteSetting.default_email_mailing_list_mode = true
|
||||
SiteSetting.default_email_mailing_list_mode_frequency = 1
|
||||
|
||||
|
|
|
@ -1066,6 +1066,7 @@ describe User do
|
|||
|
||||
context "with a reply" do
|
||||
before do
|
||||
SiteSetting.queue_jobs = false
|
||||
PostCreator.new(Fabricate(:user),
|
||||
raw: 'whatever this is a raw post',
|
||||
topic_id: topic.id,
|
||||
|
@ -1237,7 +1238,6 @@ describe User do
|
|||
describe "refresh_avatar" do
|
||||
it "enqueues the update_gravatar job when automatically downloading gravatars" do
|
||||
SiteSetting.automatically_download_gravatars = true
|
||||
SiteSetting.queue_jobs = true
|
||||
|
||||
user = Fabricate(:user)
|
||||
|
||||
|
|
|
@ -80,10 +80,6 @@ describe WebHook do
|
|||
end
|
||||
|
||||
describe '#enqueue_hooks' do
|
||||
before do
|
||||
SiteSetting.queue_jobs = true
|
||||
end
|
||||
|
||||
it 'accepts additional parameters' do
|
||||
payload = { test: 'some payload' }.to_json
|
||||
WebHook.enqueue_hooks(:post, payload: payload)
|
||||
|
@ -125,7 +121,6 @@ describe WebHook do
|
|||
let(:topic_web_hook) { Fabricate(:topic_web_hook) }
|
||||
|
||||
before do
|
||||
SiteSetting.queue_jobs = true
|
||||
topic_web_hook
|
||||
end
|
||||
|
||||
|
|
|
@ -158,6 +158,10 @@ RSpec.configure do |config|
|
|||
# very expensive IO operations
|
||||
SiteSetting.automatically_download_gravatars = false
|
||||
|
||||
# Running jobs are expensive and most of our tests are not concern with
|
||||
# code that runs inside jobs
|
||||
SiteSetting.queue_jobs = true
|
||||
|
||||
Discourse.clear_readonly!
|
||||
Sidekiq::Worker.clear_all
|
||||
|
||||
|
|
|
@ -36,12 +36,14 @@ RSpec.describe Admin::FlagsController do
|
|||
context '#agree' do
|
||||
it 'should work' do
|
||||
SiteSetting.allow_user_locale = true
|
||||
SiteSetting.queue_jobs = false
|
||||
|
||||
post_action = PostAction.act(user, post_1, PostActionType.types[:spam], message: 'bad')
|
||||
admin.update!(locale: 'ja')
|
||||
|
||||
post "/admin/flags/agree/#{post_1.id}.json"
|
||||
|
||||
expect(response).to be_success
|
||||
expect(response.status).to eq(200)
|
||||
|
||||
post_action.reload
|
||||
|
||||
|
|
|
@ -78,6 +78,8 @@ RSpec.describe Admin::GroupsController do
|
|||
let(:user2) { Fabricate(:user, trust_level: 4) }
|
||||
|
||||
it "can assign users to a group by email or username" do
|
||||
SiteSetting.queue_jobs = false
|
||||
|
||||
put "/admin/groups/bulk.json", params: {
|
||||
group_id: group.id, users: [user.username.upcase, user2.email, 'doesnt_exist']
|
||||
}
|
||||
|
|
|
@ -15,8 +15,6 @@ RSpec.describe Admin::UsersController do
|
|||
end
|
||||
|
||||
it 'should able to disable the second factor for another user' do
|
||||
SiteSetting.queue_jobs = true
|
||||
|
||||
expect do
|
||||
put "/admin/users/#{user.id}/disable_second_factor.json"
|
||||
end.to change { Jobs::CriticalUserEmail.jobs.length }.by(1)
|
||||
|
|
|
@ -80,6 +80,10 @@ describe EmbedController do
|
|||
context "success" do
|
||||
let(:headers) { { 'REFERER' => 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")
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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|
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe UsernameChanger do
|
||||
before do
|
||||
SiteSetting.queue_jobs = false
|
||||
end
|
||||
|
||||
describe '#change' do
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
|
Loading…
Reference in New Issue