mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
74b3807f60
* FEATURE: new bootstrap mode settings for brand new Discourse community * new SiteSetting.set_and_log method
33 lines
1.1 KiB
Ruby
33 lines
1.1 KiB
Ruby
require 'rails_helper'
|
|
|
|
describe Jobs::EnableBootstrapMode do
|
|
|
|
context '.execute' do
|
|
let(:admin) { Fabricate(:admin) }
|
|
|
|
before do
|
|
SiteSetting.bootstrap_mode_enabled = false
|
|
end
|
|
|
|
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 'successfully turns on bootstrap mode' do
|
|
StaffActionLogger.any_instance.expects(:log_site_setting_change).times(3)
|
|
Jobs::EnableBootstrapMode.new.execute(user_id: admin.id)
|
|
end
|
|
end
|
|
end
|