Fix all the errors to get our tests green on Rails 5.1.

This commit is contained in:
Guo Xiang Tan
2017-08-31 12:06:56 +08:00
parent 898ee93547
commit 77d4c4d8dc
989 changed files with 5114 additions and 3117 deletions

View File

@ -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