2019-10-17 02:07:30 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-05-02 03:29:39 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-16 14:09:01 -04:00
|
|
|
RSpec.describe Projects::DeployKeysController, '(JavaScript fixtures)', type: :controller do
|
2017-05-02 03:29:39 -04:00
|
|
|
include JavaScriptFixturesHelpers
|
2020-12-07 07:10:00 -05:00
|
|
|
include AdminModeHelper
|
2017-05-02 03:29:39 -04:00
|
|
|
|
|
|
|
let(:admin) { create(:admin) }
|
2022-08-19 14:10:17 -04:00
|
|
|
let(:namespace) { create(:namespace, name: 'frontend-fixtures' ) }
|
2017-05-02 03:29:39 -04:00
|
|
|
let(:project) { create(:project_empty_repo, namespace: namespace, path: 'todos-project') }
|
2022-08-19 14:10:17 -04:00
|
|
|
let(:project2) { create(:project, :internal) }
|
|
|
|
let(:project3) { create(:project, :internal) }
|
|
|
|
let(:project4) { create(:project, :internal) }
|
2017-05-02 03:29:39 -04:00
|
|
|
|
2017-08-10 18:31:42 -04:00
|
|
|
before do
|
2020-12-07 07:10:00 -05:00
|
|
|
# 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-05-02 03:29:39 -04:00
|
|
|
sign_in(admin)
|
2020-12-07 07:10:00 -05:00
|
|
|
enable_admin_mode!(admin)
|
2017-05-02 03:29:39 -04:00
|
|
|
end
|
2017-08-22 19:19:35 -04:00
|
|
|
|
|
|
|
after do
|
|
|
|
remove_repository(project)
|
|
|
|
end
|
2017-05-02 03:29:39 -04:00
|
|
|
|
|
|
|
render_views
|
|
|
|
|
2019-04-21 06:58:07 -04:00
|
|
|
it 'deploy_keys/keys.json' do
|
2022-07-12 14:08:46 -04:00
|
|
|
create(:rsa_deploy_key_5120, public: true)
|
|
|
|
project_key = create(:deploy_key)
|
|
|
|
internal_key = create(:deploy_key)
|
2017-05-02 03:29:39 -04:00
|
|
|
create(:deploy_keys_project, project: project, deploy_key: project_key)
|
|
|
|
create(:deploy_keys_project, project: project2, deploy_key: internal_key)
|
2018-05-07 14:21:34 -04:00
|
|
|
create(:deploy_keys_project, project: project3, deploy_key: project_key)
|
|
|
|
create(:deploy_keys_project, project: project4, deploy_key: project_key)
|
2017-05-02 03:29:39 -04:00
|
|
|
|
2018-12-19 14:50:20 -05:00
|
|
|
get :index, params: {
|
2017-05-02 03:29:39 -04:00
|
|
|
namespace_id: project.namespace.to_param,
|
2018-12-19 14:50:20 -05:00
|
|
|
project_id: project
|
|
|
|
}, format: :json
|
2017-05-02 03:29:39 -04:00
|
|
|
|
2019-07-17 18:15:53 -04:00
|
|
|
expect(response).to be_successful
|
2017-05-02 03:29:39 -04:00
|
|
|
end
|
|
|
|
end
|