Revert "DEV: Queue jobs in tests by default."
Too risky for now
This reverts commit be28154d3b
.
This commit is contained in:
parent
2b783997fa
commit
56e9ff6853
|
@ -4,6 +4,7 @@ describe "Discobot welcome post" do
|
|||
let(:user) { Fabricate(:user) }
|
||||
|
||||
before do
|
||||
SiteSetting.queue_jobs = true
|
||||
SiteSetting.discourse_narrative_bot_enabled = true
|
||||
end
|
||||
|
||||
|
|
|
@ -78,6 +78,7 @@ 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,6 +207,8 @@ 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,6 +389,7 @@ 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/)
|
||||
|
@ -398,6 +399,7 @@ 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,6 +266,7 @@ 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')
|
||||
|
@ -289,6 +290,10 @@ 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
|
||||
|
||||
|
@ -833,8 +838,6 @@ 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,7 +521,6 @@ 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,10 +570,6 @@ 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,6 +83,7 @@ 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,7 +10,6 @@ describe CategoriesController do
|
|||
|
||||
describe "logged in" do
|
||||
before do
|
||||
SiteSetting.queue_jobs = false
|
||||
@user = log_in(:admin)
|
||||
end
|
||||
|
||||
|
@ -50,6 +49,8 @@ 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
|
||||
|
@ -156,9 +157,6 @@ 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,6 +28,7 @@ describe Topic do
|
|||
|
||||
context 'jobs may be queued' do
|
||||
before do
|
||||
SiteSetting.queue_jobs = true
|
||||
freeze_time
|
||||
end
|
||||
|
||||
|
|
|
@ -163,7 +163,6 @@ 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,6 +9,10 @@ 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,6 +76,8 @@ 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,6 +16,10 @@ 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,7 +32,6 @@ describe Jobs::PullHotlinkedImages do
|
|||
|
||||
describe '#execute' do
|
||||
before do
|
||||
SiteSetting.queue_jobs = false
|
||||
FastImage.expects(:size).returns([100, 100]).at_least_once
|
||||
end
|
||||
|
||||
|
@ -72,6 +71,7 @@ describe Jobs::PullHotlinkedImages do
|
|||
let(:api_url) { "https://en.wikipedia.org/w/api.php?action=query&titles=#{media}&prop=imageinfo&iilimit=50&iiprop=timestamp|user|url&iiurlwidth=500&format=json" }
|
||||
|
||||
before do
|
||||
SiteSetting.queue_jobs = true
|
||||
stub_request(:head, url)
|
||||
stub_request(:get, url).to_return(body: '')
|
||||
stub_request(:get, api_url).to_return(body: "{
|
||||
|
|
|
@ -7,6 +7,10 @@ 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,6 +10,10 @@ 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,7 +68,6 @@ describe CategoryUser do
|
|||
|
||||
context 'integration' do
|
||||
before do
|
||||
SiteSetting.queue_jobs = false
|
||||
NotificationEmailer.enable
|
||||
end
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ 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,6 +429,7 @@ 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)
|
||||
|
||||
|
@ -657,7 +658,6 @@ 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,7 +39,6 @@ describe PostMover do
|
|||
let(:p6) { Fabricate(:post, topic: topic) }
|
||||
|
||||
before do
|
||||
SiteSetting.queue_jobs = false
|
||||
p1.replies << p3
|
||||
p2.replies << p4
|
||||
UserActionCreator.enable
|
||||
|
|
|
@ -2,8 +2,6 @@ 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,9 +74,6 @@ 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,8 +1214,6 @@ 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(
|
||||
|
@ -1271,6 +1269,7 @@ 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
|
||||
|
||||
|
@ -1520,8 +1519,6 @@ 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,10 +176,6 @@ 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)
|
||||
|
@ -205,10 +201,6 @@ 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)
|
||||
|
@ -247,6 +239,10 @@ 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,7 +437,6 @@ 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,7 +1066,6 @@ 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,
|
||||
|
@ -1238,6 +1237,7 @@ 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,6 +80,10 @@ 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)
|
||||
|
@ -121,6 +125,7 @@ describe WebHook do
|
|||
let(:topic_web_hook) { Fabricate(:topic_web_hook) }
|
||||
|
||||
before do
|
||||
SiteSetting.queue_jobs = true
|
||||
topic_web_hook
|
||||
end
|
||||
|
||||
|
|
|
@ -158,10 +158,6 @@ 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,14 +36,12 @@ 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.status).to eq(200)
|
||||
expect(response).to be_success
|
||||
|
||||
post_action.reload
|
||||
|
||||
|
|
|
@ -78,8 +78,6 @@ 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,6 +15,8 @@ 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,10 +80,6 @@ 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,6 +496,7 @@ 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,7 +568,6 @@ 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)
|
||||
|
@ -783,6 +782,8 @@ 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,6 +435,7 @@ 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'
|
||||
|
@ -1199,6 +1200,7 @@ 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)
|
||||
|
@ -1236,6 +1238,7 @@ 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
|
||||
|
@ -1251,6 +1254,7 @@ 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
|
||||
|
@ -1266,6 +1270,7 @@ 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,6 +258,8 @@ 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,6 +25,10 @@ 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}"
|
||||
|
@ -349,6 +353,7 @@ 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)
|
||||
|
@ -464,7 +469,8 @@ 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, password: "strongpassword")
|
||||
@user = Fabricate.build(:user)
|
||||
@user.password = "strongpassword"
|
||||
end
|
||||
|
||||
let(:post_user_params) do
|
||||
|
@ -518,6 +524,8 @@ 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
|
||||
|
@ -537,6 +545,8 @@ 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)
|
||||
|
||||
|
@ -609,6 +619,7 @@ 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
|
||||
|
||||
|
@ -689,6 +700,7 @@ 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
|
||||
|
@ -1586,8 +1598,7 @@ describe UsersController do
|
|||
password: "strongpassword",
|
||||
email: "dsdsds@sasa.com"
|
||||
}
|
||||
|
||||
User.find_by(username: "osamatest")
|
||||
User.where(username: "osamatest").first
|
||||
end
|
||||
|
||||
context 'for an existing user' do
|
||||
|
@ -1687,12 +1698,10 @@ describe UsersController do
|
|||
end
|
||||
|
||||
it 'should send an email' do
|
||||
expect do
|
||||
post "/u/action/send_activation_email.json", params: {
|
||||
username: user.username
|
||||
}
|
||||
end.to change { Jobs::CriticalUserEmail.jobs.size }.by(1)
|
||||
SiteSetting.queue_jobs = true
|
||||
post "/u/action/send_activation_email.json", params: { username: user.username }
|
||||
|
||||
expect(Jobs::CriticalUserEmail.jobs.size).to eq(1)
|
||||
expect(session[SessionController::ACTIVATE_USER_KEY]).to eq(nil)
|
||||
end
|
||||
end
|
||||
|
@ -1700,6 +1709,7 @@ 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)
|
||||
|
@ -2681,6 +2691,7 @@ describe UsersController do
|
|||
|
||||
describe '#email_login' do
|
||||
before do
|
||||
SiteSetting.queue_jobs = true
|
||||
SiteSetting.enable_local_logins_via_email = true
|
||||
end
|
||||
|
||||
|
|
|
@ -3,10 +3,6 @@ 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,10 +307,6 @@ 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
|
||||
|
||||
|
@ -383,10 +379,6 @@ 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
|
||||
|
@ -637,6 +629,7 @@ 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)
|
||||
|
@ -654,7 +647,6 @@ 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,7 +120,6 @@ 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,9 +1,6 @@
|
|||
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