OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Improve storages controller spec
Wieland Lindenthal1038d706f461
diff --git a/modules/storages/spec/controller/storages_controller_spec.rb b/modules/storages/spec/controller/storages_controller_spec.rbindex ddfebe8055f..aa27084489f 100644--- a/modules/storages/spec/controller/storages_controller_spec.rb+++ b/modules/storages/spec/controller/storages_controller_spec.rb@@ -30,44 +30,37 @@ require_relative '../spec_helper'# These specs mainly check that error messages from a sub-service# (about unsafe hosts with HTTP protocol) are passed to the main form.-describe ::Storages::Admin::StoragesController, with_flag: { storages_module_active: true }, type: :controller do+describe ::Storages::Admin::StoragesController, with_flag: { storages_module_active: true }, webmock: true, type: :controller dorender_views # rendering views is stubbed by default in controller specsinclude StorageServerHelperslet(:admin) { create :admin }- let(:host) { "www.example.com" }+ let(:schema) { "https" }+ let(:host) { "#{schema}://example.org" }let(:content_type_json) { { 'Content-Type' => 'application/json; charset=utf-8' } }+ let(:params) { { storages_storage: { name: "My Nextcloud", host: } } }before dologin_as admin+ mock_server_capabilities_response(host)+ mock_server_host_response(host)+ post :create, params:end- describe 'with valid attributes', webmock: true do- let(:params) { { storages_storage: { name: "My Nextcloud", host: "https://#{host}" } } }-- before do- mock_server_capabilities_response("https://#{host}")- post :create, params:- end-+ describe 'with valid storage attributes' doit 'is successful' doexpect(response).to be_successful- expect(response.body).not_to include("Redirect uri must be an HTTPS/SSL URI")+ expect(response.body).not_to include('Host is not providing a "Secure Context".')expect(response.body).to include(I18n.t(:notice_successful_create))endend- describe 'with invalid attributes', webmock: true do- let(:params) { { storages_storage: { name: "My Nextcloud", host: "http://#{host}" } } }-- before do- mock_server_capabilities_response("http://#{host}")- post :create, params:- end+ describe 'with invalid storage attributes' do+ let(:schema) { 'http' }- it 'complains about HTTP being invalid' do+ it 'shows the errors of the dependent service result, complaining about HTTP being invalid' doexpect(response).to be_successful # you get a 200 response despite errors...- expect(response.body).to include("Redirect uri must be an HTTPS/SSL URI")+ expect(response.body).to include('Host is not providing a "Secure Context".')endendend