mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 20:34:50 +08:00
FIX: correctly retrieve 'login required' setting value on wizard (#7355)
* FIX: correctly retrieve 'login required' setting value on wizard FEATURE: extract 'invite only' setting in a separate checkbox control * Update invite_only checkbox locale on wizard. Co-Authored-By: techAPJ <arpit@techapj.com>
This commit is contained in:
@ -63,7 +63,7 @@ describe Wizard::StepUpdater do
|
||||
|
||||
context "privacy settings" do
|
||||
it "updates to open correctly" do
|
||||
updater = wizard.create_updater('privacy', privacy: 'open')
|
||||
updater = wizard.create_updater('privacy', privacy: 'open', invite_only: false)
|
||||
updater.update
|
||||
expect(updater.success?).to eq(true)
|
||||
expect(SiteSetting.login_required?).to eq(false)
|
||||
@ -72,7 +72,7 @@ describe Wizard::StepUpdater do
|
||||
end
|
||||
|
||||
it "updates to private correctly" do
|
||||
updater = wizard.create_updater('privacy', privacy: 'restricted')
|
||||
updater = wizard.create_updater('privacy', privacy: 'restricted', invite_only: true)
|
||||
updater.update
|
||||
expect(updater.success?).to eq(true)
|
||||
expect(SiteSetting.login_required?).to eq(true)
|
||||
|
@ -113,4 +113,22 @@ describe Wizard::Builder do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'privacy step' do
|
||||
let(:privacy_step) { wizard.steps.find { |s| s.id == 'privacy' } }
|
||||
|
||||
it 'should set the right default value for the fields' do
|
||||
SiteSetting.login_required = true
|
||||
SiteSetting.invite_only = false
|
||||
|
||||
fields = privacy_step.fields
|
||||
login_required_field = fields.first
|
||||
invite_only_field = fields.last
|
||||
|
||||
expect(login_required_field.id).to eq('privacy')
|
||||
expect(login_required_field.value).to eq("restricted")
|
||||
expect(invite_only_field.id).to eq('invite_only')
|
||||
expect(invite_only_field.value).to eq(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user