mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
Wizard: Step 1
This commit is contained in:
parent
0471ad393c
commit
3a4615c205
50 changed files with 1103 additions and 80 deletions
35
spec/controllers/steps_controller_spec.rb
Normal file
35
spec/controllers/steps_controller_spec.rb
Normal file
|
@ -0,0 +1,35 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe StepsController do
|
||||
|
||||
it 'needs you to be logged in' do
|
||||
expect {
|
||||
xhr :put, :update, id: 'made-up-id', fields: { forum_title: "updated title" }
|
||||
}.to raise_error(Discourse::NotLoggedIn)
|
||||
end
|
||||
|
||||
it "raises an error if you aren't an admin" do
|
||||
log_in
|
||||
xhr :put, :update, id: 'made-up-id', fields: { forum_title: "updated title" }
|
||||
expect(response).to be_forbidden
|
||||
end
|
||||
|
||||
context "as an admin" do
|
||||
before do
|
||||
log_in(:admin)
|
||||
end
|
||||
|
||||
it "raises an error with an invalid id" do
|
||||
xhr :put, :update, id: 'made-up-id', fields: { forum_title: "updated title" }
|
||||
expect(response).to_not be_success
|
||||
end
|
||||
|
||||
it "updates properly if you are staff" do
|
||||
xhr :put, :update, id: 'forum-title', fields: { title: "updated title" }
|
||||
expect(response).to be_success
|
||||
expect(SiteSetting.title).to eq("updated title")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue