debian-mirror-gitlab/spec/frontend/fixtures/deploy_keys.rb

46 lines
1.5 KiB
Ruby
Raw Normal View History

2019-12-21 20:55:43 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
require 'spec_helper'
2020-06-23 00:09:42 +05:30
RSpec.describe Projects::DeployKeysController, '(JavaScript fixtures)', type: :controller do
2017-08-17 22:00:37 +05:30
include JavaScriptFixturesHelpers
2021-02-22 17:27:13 +05:30
include AdminModeHelper
2017-08-17 22:00:37 +05:30
let(:admin) { create(:admin) }
2023-01-13 00:05:48 +05:30
let(:namespace) { create(:namespace, name: 'frontend-fixtures') }
2017-08-17 22:00:37 +05:30
let(:project) { create(:project_empty_repo, namespace: namespace, path: 'todos-project') }
2022-10-11 01:57:18 +05:30
let(:project2) { create(:project, :internal) }
let(:project3) { create(:project, :internal) }
let(:project4) { create(:project, :internal) }
2017-08-17 22:00:37 +05:30
2018-03-17 18:26:18 +05:30
before do
2021-02-22 17:27:13 +05:30
# Using an admin for these fixtures because they are used for verifying a frontend
# component that would normally get its data from `Admin::DeployKeysController`
2017-08-17 22:00:37 +05:30
sign_in(admin)
2021-02-22 17:27:13 +05:30
enable_admin_mode!(admin)
2017-08-17 22:00:37 +05:30
end
2018-03-17 18:26:18 +05:30
after do
remove_repository(project)
end
2017-08-17 22:00:37 +05:30
render_views
2019-09-04 21:01:54 +05:30
it 'deploy_keys/keys.json' do
2022-08-13 15:12:31 +05:30
create(:rsa_deploy_key_5120, public: true)
project_key = create(:deploy_key)
internal_key = create(:deploy_key)
2017-08-17 22:00:37 +05:30
create(:deploy_keys_project, project: project, deploy_key: project_key)
create(:deploy_keys_project, project: project2, deploy_key: internal_key)
2018-10-15 14:42:47 +05:30
create(:deploy_keys_project, project: project3, deploy_key: project_key)
create(:deploy_keys_project, project: project4, deploy_key: project_key)
2017-08-17 22:00:37 +05:30
2019-02-15 15:39:39 +05:30
get :index, params: {
2017-08-17 22:00:37 +05:30
namespace_id: project.namespace.to_param,
2019-02-15 15:39:39 +05:30
project_id: project
}, format: :json
2017-08-17 22:00:37 +05:30
2019-10-12 21:52:04 +05:30
expect(response).to be_successful
2017-08-17 22:00:37 +05:30
end
end