diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-11 12:10:29 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-11 12:10:29 +0300 |
commit | 871b886a1794e5baefd6b2f96caf2ac4ce5da6ca (patch) | |
tree | a92b04af5c5704314c31981ac4bb92c1489c46fd /spec/controllers | |
parent | c0496e1078f8612b0c468430a79bd03c8102e2b9 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/admin/application_settings_controller_spec.rb | 37 | ||||
-rw-r--r-- | spec/controllers/repositories/git_http_controller_spec.rb | 10 |
2 files changed, 42 insertions, 5 deletions
diff --git a/spec/controllers/admin/application_settings_controller_spec.rb b/spec/controllers/admin/application_settings_controller_spec.rb index 537424093fb..60343c822af 100644 --- a/spec/controllers/admin/application_settings_controller_spec.rb +++ b/spec/controllers/admin/application_settings_controller_spec.rb @@ -487,6 +487,43 @@ RSpec.describe Admin::ApplicationSettingsController, :do_not_mock_admin_mode_set end end + describe 'GET #slack_app_manifest_download', feature_category: :integrations do + before do + sign_in(admin) + end + + subject { get :slack_app_manifest_download } + + it 'downloads the GitLab for Slack app manifest' do + allow(Slack::Manifest).to receive(:to_h).and_return({ foo: 'bar' }) + + subject + + expect(response.body).to eq('{"foo":"bar"}') + expect(response.headers['Content-Disposition']).to eq( + 'attachment; filename="slack_manifest.json"; filename*=UTF-8\'\'slack_manifest.json' + ) + end + end + + describe 'GET #slack_app_manifest_share', feature_category: :integrations do + before do + sign_in(admin) + end + + subject { get :slack_app_manifest_share } + + it 'redirects the user to the Slack Manifest share URL' do + allow(Slack::Manifest).to receive(:to_h).and_return({ foo: 'bar' }) + + subject + + expect(response).to redirect_to( + "https://api.slack.com/apps?new_app=1&manifest_json=%7B%22foo%22%3A%22bar%22%7D" + ) + end + end + describe 'GET #service_usage_data', feature_category: :service_ping do before do stub_usage_data_connections diff --git a/spec/controllers/repositories/git_http_controller_spec.rb b/spec/controllers/repositories/git_http_controller_spec.rb index 276bd9b65b9..88af7d1fe45 100644 --- a/spec/controllers/repositories/git_http_controller_spec.rb +++ b/spec/controllers/repositories/git_http_controller_spec.rb @@ -79,7 +79,7 @@ RSpec.describe Repositories::GitHttpController, feature_category: :source_code_m end context 'when repository container is a project' do - it_behaves_like Repositories::GitHttpController do + it_behaves_like described_class do let(:container) { project } let(:user) { project.first_owner } let(:access_checker_class) { Gitlab::GitAccess } @@ -133,7 +133,7 @@ RSpec.describe Repositories::GitHttpController, feature_category: :source_code_m end context 'when the user is a deploy token' do - it_behaves_like Repositories::GitHttpController do + it_behaves_like described_class do let(:container) { project } let(:user) { create(:deploy_token, :project, projects: [project]) } let(:access_checker_class) { Gitlab::GitAccess } @@ -144,7 +144,7 @@ RSpec.describe Repositories::GitHttpController, feature_category: :source_code_m end context 'when repository container is a project wiki' do - it_behaves_like Repositories::GitHttpController do + it_behaves_like described_class do let(:container) { create(:project_wiki, :empty_repo, project: project) } let(:user) { project.first_owner } let(:access_checker_class) { Gitlab::GitAccessWiki } @@ -155,7 +155,7 @@ RSpec.describe Repositories::GitHttpController, feature_category: :source_code_m end context 'when repository container is a personal snippet' do - it_behaves_like Repositories::GitHttpController do + it_behaves_like described_class do let(:container) { personal_snippet } let(:user) { personal_snippet.author } let(:access_checker_class) { Gitlab::GitAccessSnippet } @@ -167,7 +167,7 @@ RSpec.describe Repositories::GitHttpController, feature_category: :source_code_m end context 'when repository container is a project snippet' do - it_behaves_like Repositories::GitHttpController do + it_behaves_like described_class do let(:container) { project_snippet } let(:user) { project_snippet.author } let(:access_checker_class) { Gitlab::GitAccessSnippet } |