Commit f5f0974b authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix tests and features to make specs pass

* Add Audit events link to project settings tab and make audit tests work
* Fix 404 when remove deploy key
* Fix pipelines quota specs
Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 8b5250cf
......@@ -38,9 +38,8 @@ class Projects::DeployKeysController < Projects::ApplicationController
deploy_key_project = @project.deploy_keys_projects.find_by(deploy_key_id: params[:id])
return render_404 unless deploy_key_project
deploy_key_project.destroy!
load_key
deploy_key_project.destroy!
log_audit_event(@key.title, action: :destroy)
redirect_to_repository_settings(@project)
......
......@@ -31,3 +31,9 @@
= link_to namespace_project_pages_path(@project.namespace, @project), title: 'Pages' do
%span
Pages
= nav_link(controller: :audit_events) do
= link_to namespace_project_audit_events_path(@project.namespace, @project), title: "Audit Events" do
%span
Audit Events
......@@ -18,10 +18,10 @@ feature 'Groups > Audit Events', js: true, feature: true do
click_link 'Members'
group_member = group.members.find_by(user_id: pete)
page.within "#group_member_#{group_member.id}" do
click_button 'Edit access level'
select 'Master', from: 'group_member_access_level'
click_button 'Save'
click_button 'Developer'
click_link 'Master'
end
# This is to avoid a Capybara::Poltergeist::MouseEventFailed error
......
......@@ -36,11 +36,9 @@ feature 'Groups > Pipeline Quota', feature: true do
let!(:project) { create(:empty_project, namespace: group, shared_runners_enabled: false) }
it 'is not linked within the group settings dropdown' do
visit group_path(group)
visit edit_group_path(group)
page.within('.layout-nav') do
expect(page).not_to have_selector(:link_or_button, 'Pipeline Quota')
end
expect(page).not_to have_link('Pipelines quota')
end
it 'shows correct group quota info' do
......@@ -60,12 +58,10 @@ feature 'Groups > Pipeline Quota', feature: true do
context 'minutes under quota' do
let(:group) { create(:group, :with_not_used_build_minutes_limit) }
it 'is linked within the group settings dropdown' do
visit group_path(group)
it 'is linked within the group settings tab' do
visit edit_group_path(group)
page.within('.layout-nav') do
expect(page).to have_selector(:link_or_button, 'Pipeline Quota')
end
expect(page).to have_link('Pipelines quota')
end
it 'shows correct group quota info' do
......@@ -83,12 +79,10 @@ feature 'Groups > Pipeline Quota', feature: true do
let(:group) { create(:group, :with_used_build_minutes_limit) }
let!(:other_project) { create(:empty_project, namespace: group, shared_runners_enabled: false) }
it 'is linked within the group settings dropdown' do
visit group_path(group)
it 'is linked within the group settings tab' do
visit edit_group_path(group)
page.within('.layout-nav') do
expect(page).to have_selector(:link_or_button, 'Pipeline Quota')
end
expect(page).to have_link('Pipelines quota')
end
it 'shows correct group quota and projects info' do
......
......@@ -17,14 +17,17 @@ feature 'Projects > Audit Events', js: true, feature: true do
fill_in 'deploy_key_title', with: 'laptop'
fill_in 'deploy_key_key', with: 'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzrEJUIR6Y03TCE9rIJ+GqTBvgb8t1jI9h5UBzCLuK4VawOmkLornPqLDrGbm6tcwM/wBrrLvVOqi2HwmkKEIecVO0a64A4rIYScVsXIniHRS6w5twyn1MD3sIbN+socBDcaldECQa2u1dI3tnNVcs8wi77fiRe7RSxePsJceGoheRQgC8AZ510UdIlO+9rjIHUdVN7LLyz512auAfYsgx1OfablkQ/XJcdEwDNgi9imI6nAXhmoKUm1IPLT2yKajTIC64AjLOnE0YyCh6+7RFMpiMyu1qiOCpdjYwTgBRiciNRZCH8xIedyCoAmiUgkUT40XYHwLuwiPJICpkAzp7Q== user@laptop'
click_button 'Create'
click_button 'Add key'
visit namespace_project_audit_events_path(project.namespace, project)
expect(page).to have_content('Add deploy key')
visit namespace_project_deploy_keys_path(project.namespace, project)
accept_confirm do
click_link 'Remove'
end
visit namespace_project_audit_events_path(project.namespace, project)
......@@ -38,15 +41,13 @@ feature 'Projects > Audit Events', js: true, feature: true do
end
it "appears in the project's audit events" do
visit namespace_project_path(project.namespace, project)
click_link 'Members'
visit namespace_project_settings_members_path(project.namespace, project)
project_member = project.project_member(pete)
page.within "#project_member_#{project_member.id}" do
click_button 'Edit access level'
select 'Master', from: 'project_member_access_level'
click_button 'Save'
click_button 'Developer'
click_link 'Master'
end
# This is to avoid a Capybara::Poltergeist::MouseEventFailed error
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment