mirror of
https://github.com/discourse/discourse.git
synced 2024-12-12 21:24:07 +08:00
9d88f80f26
Previously, when the new site was created and after the first admin login, no one will receive notifications to review the user approval queue since only the moderators would receive the PMs about it. Also, this PR will change the "pending_users_reminder_delay_minutes" site setting to 5 minutes while the site is in bootstrap mode.
40 lines
1.4 KiB
Ruby
40 lines
1.4 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe Jobs::EnableBootstrapMode do
|
|
describe ".execute" do
|
|
fab!(:admin)
|
|
|
|
before { SiteSetting.bootstrap_mode_enabled = false }
|
|
|
|
it "raises an error when user_id is missing" do
|
|
expect { Jobs::EnableBootstrapMode.new.execute({}) }.to raise_error(
|
|
Discourse::InvalidParameters,
|
|
)
|
|
end
|
|
|
|
it "does not execute if bootstrap mode is already enabled" do
|
|
SiteSetting.bootstrap_mode_enabled = true
|
|
StaffActionLogger.any_instance.expects(:log_site_setting_change).never
|
|
Jobs::EnableBootstrapMode.new.execute(user_id: admin.id)
|
|
end
|
|
|
|
it "does not turn on bootstrap mode if first admin already exists" do
|
|
first_admin = Fabricate(:admin)
|
|
StaffActionLogger.any_instance.expects(:log_site_setting_change).never
|
|
Jobs::EnableBootstrapMode.new.execute(user_id: admin.id)
|
|
end
|
|
|
|
it "does not amend setting that is not in default state" do
|
|
SiteSetting.default_trust_level = TrustLevel[3]
|
|
StaffActionLogger.any_instance.expects(:log_site_setting_change).times(3)
|
|
Jobs::EnableBootstrapMode.new.execute(user_id: admin.id)
|
|
end
|
|
|
|
it "successfully turns on bootstrap mode" do
|
|
StaffActionLogger.any_instance.expects(:log_site_setting_change).times(4)
|
|
Jobs::EnableBootstrapMode.new.execute(user_id: admin.id)
|
|
expect(admin.reload.moderator).to be_truthy
|
|
end
|
|
end
|
|
end
|