diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2017-06-21 12:18:27 +0000 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2017-06-21 12:18:27 +0000 |
commit | 7d0d6a8245361db0863d0258ffc9d3b669c6477d (patch) | |
tree | 80817ebee63dd6229f81d247d5592d0ad1e471be /spec | |
parent | 090ed087f0aba10dff142e48d97259fec28b89bb (diff) | |
parent | 853d06b99f4ea5ab718f15c03bfed42288d527d4 (diff) | |
download | gitlab-ce-7d0d6a8245361db0863d0258ffc9d3b669c6477d.tar.gz |
Merge branch 'master' into 'fix/gb/improve-build-stage-reference-migration'
# Conflicts:
# db/schema.rb
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/projects/settings/repository_settings_spec.rb | 17 | ||||
-rw-r--r-- | spec/lib/gitlab/regex_spec.rb | 12 | ||||
-rw-r--r-- | spec/requests/api/deploy_keys_spec.rb | 10 |
3 files changed, 39 insertions, 0 deletions
diff --git a/spec/features/projects/settings/repository_settings_spec.rb b/spec/features/projects/settings/repository_settings_spec.rb index 2956ef73746..35cd0d6e832 100644 --- a/spec/features/projects/settings/repository_settings_spec.rb +++ b/spec/features/projects/settings/repository_settings_spec.rb @@ -65,6 +65,23 @@ feature 'Repository settings', feature: true do expect(page).to have_content('Write access allowed') end + scenario 'edit a deploy key from projects user has access to' do + project2 = create(:project_empty_repo) + project2.team << [user, role] + project2.deploy_keys << private_deploy_key + + visit namespace_project_settings_repository_path(project.namespace, project) + + find('li', text: private_deploy_key.title).click_link('Edit') + + fill_in 'deploy_key_title', with: 'updated_deploy_key' + check 'deploy_key_can_push' + click_button 'Save changes' + + expect(page).to have_content('updated_deploy_key') + expect(page).to have_content('Write access allowed') + end + scenario 'remove an existing deploy key' do project.deploy_keys << private_deploy_key visit namespace_project_settings_repository_path(project.namespace, project) diff --git a/spec/lib/gitlab/regex_spec.rb b/spec/lib/gitlab/regex_spec.rb index 0bee892fe0c..979f4fefcb6 100644 --- a/spec/lib/gitlab/regex_spec.rb +++ b/spec/lib/gitlab/regex_spec.rb @@ -21,6 +21,18 @@ describe Gitlab::Regex, lib: true do end describe '.environment_slug_regex' do + subject { described_class.environment_name_regex } + + it { is_expected.to match('foo') } + it { is_expected.to match('foo-1') } + it { is_expected.to match('FOO') } + it { is_expected.to match('foo/1') } + it { is_expected.to match('foo.1') } + it { is_expected.not_to match('9&foo') } + it { is_expected.not_to match('foo-^') } + end + + describe '.environment_slug_regex' do subject { described_class.environment_slug_regex } it { is_expected.to match('foo') } diff --git a/spec/requests/api/deploy_keys_spec.rb b/spec/requests/api/deploy_keys_spec.rb index 9c260f88f56..32439981b60 100644 --- a/spec/requests/api/deploy_keys_spec.rb +++ b/spec/requests/api/deploy_keys_spec.rb @@ -160,6 +160,16 @@ describe API::DeployKeys do expect(json_response['title']).to eq('new title') expect(json_response['can_push']).to eq(true) end + + it 'updates a private ssh key from projects user has access with correct attributes' do + create(:deploy_keys_project, project: project2, deploy_key: private_deploy_key) + + put api("/projects/#{project.id}/deploy_keys/#{private_deploy_key.id}", admin), { title: 'new title', can_push: true } + + expect(json_response['id']).to eq(private_deploy_key.id) + expect(json_response['title']).to eq('new title') + expect(json_response['can_push']).to eq(true) + end end describe 'DELETE /projects/:id/deploy_keys/:key_id' do |