gitlab-org--gitlab-foss/spec/frontend/fixtures/deploy_keys.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

46 lines
1.5 KiB
Ruby
Raw Normal View History

# frozen_string_literal: true
2017-05-02 03:29:39 -04:00
require 'spec_helper'
RSpec.describe Projects::DeployKeysController, '(JavaScript fixtures)', type: :controller do
2017-05-02 03:29:39 -04:00
include JavaScriptFixturesHelpers
include AdminModeHelper
2017-05-02 03:29:39 -04:00
let(:admin) { create(:admin) }
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') }
let(:project2) { create(:project, :internal) }
let(:project3) { create(:project, :internal) }
let(:project4) { create(:project, :internal) }
2017-05-02 03:29:39 -04:00
before do
# 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)
enable_admin_mode!(admin)
2017-05-02 03:29:39 -04:00
end
after do
remove_repository(project)
end
2017-05-02 03:29:39 -04:00
render_views
it 'deploy_keys/keys.json' do
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)
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
get :index, params: {
2017-05-02 03:29:39 -04:00
namespace_id: project.namespace.to_param,
project_id: project
}, format: :json
2017-05-02 03:29:39 -04:00
expect(response).to be_successful
2017-05-02 03:29:39 -04:00
end
end