A platform for community discussion. Free, open, simple.
REFACTOR: wizard controller specs to requests
OsamaSayegh3244fb8959f6
diff --git a/spec/controllers/wizard_controller_spec.rb b/spec/requests/wizard_controller_spec.rbsimilarity index 77%rename from spec/controllers/wizard_controller_spec.rbrename to spec/requests/wizard_controller_spec.rbindex 0875e31c264..c9736a03d5b 100644--- a/spec/controllers/wizard_controller_spec.rb+++ b/spec/requests/wizard_controller_spec.rb@@ -1,51 +1,47 @@require 'rails_helper'describe WizardController do-context 'wizard enabled' do- render_views-before doSiteSetting.wizard_enabled = trueendit 'needs you to be logged in' do- get :index, format: :json+ get "/wizard.json"expect(response.status).to eq(403)endit 'needs you to be logged in' do- get :index+ get "/wizard"# for whatever reason, no access is 404# we may want to revisit this at some point and make it 403expect(response.status).to eq(404)endit "raises an error if you aren't an admin" do- log_in(:moderator)- get :index, format: :json+ sign_in(Fabricate(:moderator))+ get "/wizard.json"expect(response).to be_forbiddenendit "raises an error if the wizard is disabled" doSiteSetting.wizard_enabled = false- log_in(:admin)- get :index, format: :json+ sign_in(Fabricate(:admin))+ get "/wizard.json"expect(response).to be_forbiddenendit "renders the wizard if you are an admin" do- log_in(:admin)- get :index, format: :json+ sign_in(Fabricate(:admin))+ get "/wizard.json"expect(response).to be_successendit "returns JSON when the mime type is appropriate" do- log_in(:admin)- get :index, format: 'json'+ sign_in(Fabricate(:admin))+ get "/wizard.json"expect(response).to be_successexpect(::JSON.parse(response.body).has_key?('wizard')).to eq(true)endend-end