mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
Fix all the errors to get our tests green on Rails 5.1.
This commit is contained in:
@ -10,31 +10,33 @@ describe WizardController do
|
||||
end
|
||||
|
||||
it 'needs you to be logged in' do
|
||||
expect { xhr :get, :index }.to raise_error(Discourse::NotLoggedIn)
|
||||
expect do
|
||||
get :index, format: :json
|
||||
end.to raise_error(Discourse::NotLoggedIn)
|
||||
end
|
||||
|
||||
it "raises an error if you aren't an admin" do
|
||||
log_in(:moderator)
|
||||
xhr :get, :index
|
||||
get :index, format: :json
|
||||
expect(response).to be_forbidden
|
||||
end
|
||||
|
||||
it "raises an error if the wizard is disabled" do
|
||||
SiteSetting.wizard_enabled = false
|
||||
log_in(:admin)
|
||||
xhr :get, :index
|
||||
get :index, format: :json
|
||||
expect(response).to be_forbidden
|
||||
end
|
||||
|
||||
it "renders the wizard if you are an admin" do
|
||||
log_in(:admin)
|
||||
xhr :get, :index
|
||||
get :index, format: :json
|
||||
expect(response).to be_success
|
||||
end
|
||||
|
||||
it "returns JSON when the mime type is appropriate" do
|
||||
log_in(:admin)
|
||||
xhr :get, :index, format: 'json'
|
||||
get :index, format: 'json'
|
||||
expect(response).to be_success
|
||||
expect(::JSON.parse(response.body).has_key?('wizard')).to eq(true)
|
||||
end
|
||||
|
Reference in New Issue
Block a user