mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Apply syntax_tree formatting to spec/*
This commit is contained in:
@@ -1,52 +1,49 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe StepsController do
|
||||
before do
|
||||
SiteSetting.wizard_enabled = true
|
||||
end
|
||||
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" }
|
||||
}
|
||||
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" }
|
||||
}
|
||||
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 do
|
||||
sign_in(Fabricate(:admin))
|
||||
end
|
||||
before { sign_in(Fabricate(:admin)) }
|
||||
|
||||
it "raises an error if the wizard is disabled" do
|
||||
SiteSetting.wizard_enabled = false
|
||||
put "/wizard/steps/introduction.json", params: {
|
||||
fields: { contact_email: "eviltrout@example.com" }
|
||||
}
|
||||
put "/wizard/steps/introduction.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/introduction.json", params: {
|
||||
fields: { title: "FooBar", default_locale: SiteSetting.default_locale }
|
||||
}
|
||||
put "/wizard/steps/introduction.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
|
||||
put "/wizard/steps/introduction.json", params: {
|
||||
fields: { title: "" }
|
||||
}
|
||||
put "/wizard/steps/introduction.json", params: { fields: { title: "" } }
|
||||
|
||||
expect(response.status).to eq(422)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user