mirror of
https://github.com/discourse/discourse.git
synced 2026-03-04 01:15:08 +08:00
Consolidates all three wizard screens into one. Cleans up some leftover, unused wizard elements (checkbox, image, canvas inputs). Internal ticket: t/164852 <img width="2880" height="2376" alt="CleanShot 2025-11-25 at 10 35 43@2x" src="https://github.com/user-attachments/assets/f824a172-38b0-4fda-922a-3732335b93b2" /> --------- Co-authored-by: Jordan Vidrine <jordan@jordanvidrine.com>
47 lines
1.3 KiB
Ruby
47 lines
1.3 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe StepsController do
|
|
before { SiteSetting.wizard_enabled = true }
|
|
|
|
it "needs you to be logged in" do
|
|
put "/wizard/steps/made-up-id.json", params: { fields: { forum_title: "updated title" } }
|
|
expect(response.status).to eq(403)
|
|
end
|
|
|
|
it "raises an error if you aren't an admin" do
|
|
sign_in(Fabricate(:moderator))
|
|
|
|
put "/wizard/steps/made-up-id.json", params: { fields: { forum_title: "updated title" } }
|
|
|
|
expect(response).to be_forbidden
|
|
end
|
|
|
|
context "as an admin" do
|
|
before { sign_in(Fabricate(:admin)) }
|
|
|
|
it "raises an error if the wizard is disabled" do
|
|
SiteSetting.wizard_enabled = false
|
|
put "/wizard/steps/setup.json", params: { fields: { contact_email: "eviltrout@example.com" } }
|
|
expect(response).to be_forbidden
|
|
end
|
|
|
|
it "updates properly if you are staff" do
|
|
put "/wizard/steps/setup.json",
|
|
params: {
|
|
fields: {
|
|
title: "FooBar",
|
|
default_locale: SiteSetting.default_locale,
|
|
},
|
|
}
|
|
|
|
expect(response.status).to eq(200)
|
|
end
|
|
|
|
it "returns errors if the field has them" do
|
|
title = SiteSetting.title
|
|
put "/wizard/steps/setup.json", params: { fields: { title: } }
|
|
|
|
expect(response.status).to eq(422)
|
|
end
|
|
end
|
|
end
|