Commit 0cd25515 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'dz-fix-spec-filenames' into 'master'

Fix incorrect spec filenames which were ingored by CI

Closes #2250

See merge request !1709
parents 4552e8e7 f5f0974b
...@@ -38,9 +38,8 @@ class Projects::DeployKeysController < Projects::ApplicationController ...@@ -38,9 +38,8 @@ class Projects::DeployKeysController < Projects::ApplicationController
deploy_key_project = @project.deploy_keys_projects.find_by(deploy_key_id: params[:id]) deploy_key_project = @project.deploy_keys_projects.find_by(deploy_key_id: params[:id])
return render_404 unless deploy_key_project return render_404 unless deploy_key_project
deploy_key_project.destroy!
load_key load_key
deploy_key_project.destroy!
log_audit_event(@key.title, action: :destroy) log_audit_event(@key.title, action: :destroy)
redirect_to_repository_settings(@project) redirect_to_repository_settings(@project)
......
...@@ -31,3 +31,9 @@ ...@@ -31,3 +31,9 @@
= link_to namespace_project_pages_path(@project.namespace, @project), title: 'Pages' do = link_to namespace_project_pages_path(@project.namespace, @project), title: 'Pages' do
%span %span
Pages Pages
= nav_link(controller: :audit_events) do
= link_to namespace_project_audit_events_path(@project.namespace, @project), title: "Audit Events" do
%span
Audit Events
...@@ -63,4 +63,44 @@ describe Projects::BuildsController do ...@@ -63,4 +63,44 @@ describe Projects::BuildsController do
expect(json_response['favicon']).to eq "/assets/ci_favicons/#{status.favicon}.ico" expect(json_response['favicon']).to eq "/assets/ci_favicons/#{status.favicon}.ico"
end end
end end
describe 'GET trace.json' do
let(:pipeline) { create(:ci_pipeline, project: project) }
let(:build) { create(:ci_build, pipeline: pipeline) }
let(:user) { create(:user) }
context 'when user is logged in as developer' do
before do
project.add_developer(user)
sign_in(user)
get_trace
end
it 'traces build log' do
expect(response).to have_http_status(:ok)
expect(json_response['id']).to eq build.id
expect(json_response['status']).to eq build.status
end
end
context 'when user is logged in as non member' do
before do
sign_in(user)
get_trace
end
it 'traces build log' do
expect(response).to have_http_status(:ok)
expect(json_response['id']).to eq build.id
expect(json_response['status']).to eq build.status
end
end
def get_trace
get :trace, namespace_id: project.namespace,
project_id: project,
id: build.id,
format: :json
end
end
end end
require 'spec_helper'
describe Projects::BuildsController do
include ApiHelpers
let(:project) { create(:empty_project, :public) }
describe 'GET trace.json' do
let(:pipeline) { create(:ci_pipeline, project: project) }
let(:build) { create(:ci_build, pipeline: pipeline) }
let(:user) { create(:user) }
context 'when user is logged in as developer' do
before do
project.add_developer(user)
sign_in(user)
get_trace
end
it 'traces build log' do
expect(response).to have_http_status(:ok)
expect(json_response['id']).to eq build.id
expect(json_response['status']).to eq build.status
end
end
context 'when user is logged in as non member' do
before do
sign_in(user)
get_trace
end
it 'traces build log' do
expect(response).to have_http_status(:ok)
expect(json_response['id']).to eq build.id
expect(json_response['status']).to eq build.status
end
end
def get_trace
get :trace, namespace_id: project.namespace,
project_id: project,
id: build.id,
format: :json
end
end
end
...@@ -18,10 +18,10 @@ feature 'Groups > Audit Events', js: true, feature: true do ...@@ -18,10 +18,10 @@ feature 'Groups > Audit Events', js: true, feature: true do
click_link 'Members' click_link 'Members'
group_member = group.members.find_by(user_id: pete) group_member = group.members.find_by(user_id: pete)
page.within "#group_member_#{group_member.id}" do page.within "#group_member_#{group_member.id}" do
click_button 'Edit access level' click_button 'Developer'
select 'Master', from: 'group_member_access_level' click_link 'Master'
click_button 'Save'
end end
# This is to avoid a Capybara::Poltergeist::MouseEventFailed error # This is to avoid a Capybara::Poltergeist::MouseEventFailed error
......
...@@ -36,11 +36,9 @@ feature 'Groups > Pipeline Quota', feature: true do ...@@ -36,11 +36,9 @@ feature 'Groups > Pipeline Quota', feature: true do
let!(:project) { create(:empty_project, namespace: group, shared_runners_enabled: false) } let!(:project) { create(:empty_project, namespace: group, shared_runners_enabled: false) }
it 'is not linked within the group settings dropdown' do 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_link('Pipelines quota')
expect(page).not_to have_selector(:link_or_button, 'Pipeline Quota')
end
end end
it 'shows correct group quota info' do it 'shows correct group quota info' do
...@@ -60,12 +58,10 @@ feature 'Groups > Pipeline Quota', feature: true do ...@@ -60,12 +58,10 @@ feature 'Groups > Pipeline Quota', feature: true do
context 'minutes under quota' do context 'minutes under quota' do
let(:group) { create(:group, :with_not_used_build_minutes_limit) } let(:group) { create(:group, :with_not_used_build_minutes_limit) }
it 'is linked within the group settings dropdown' do it 'is linked within the group settings tab' do
visit group_path(group) visit edit_group_path(group)
page.within('.layout-nav') do expect(page).to have_link('Pipelines quota')
expect(page).to have_selector(:link_or_button, 'Pipeline Quota')
end
end end
it 'shows correct group quota info' do it 'shows correct group quota info' do
...@@ -83,12 +79,10 @@ feature 'Groups > Pipeline Quota', feature: true do ...@@ -83,12 +79,10 @@ feature 'Groups > Pipeline Quota', feature: true do
let(:group) { create(:group, :with_used_build_minutes_limit) } let(:group) { create(:group, :with_used_build_minutes_limit) }
let!(:other_project) { create(:empty_project, namespace: group, shared_runners_enabled: false) } let!(:other_project) { create(:empty_project, namespace: group, shared_runners_enabled: false) }
it 'is linked within the group settings dropdown' do it 'is linked within the group settings tab' do
visit group_path(group) visit edit_group_path(group)
page.within('.layout-nav') do expect(page).to have_link('Pipelines quota')
expect(page).to have_selector(:link_or_button, 'Pipeline Quota')
end
end end
it 'shows correct group quota and projects info' do it 'shows correct group quota and projects info' do
......
...@@ -4,7 +4,7 @@ feature 'Resolve an open discussion in a merge request by creating an issue', fe ...@@ -4,7 +4,7 @@ feature 'Resolve an open discussion in a merge request by creating an issue', fe
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, only_allow_merge_if_all_discussions_are_resolved: true) } let(:project) { create(:project, only_allow_merge_if_all_discussions_are_resolved: true) }
let(:merge_request) { create(:merge_request, source_project: project) } let(:merge_request) { create(:merge_request, source_project: project) }
let!(:discussion) { Discussion.for_diff_notes([create(:diff_note_on_merge_request, noteable: merge_request, project: project)]).first } let!(:discussion) { create(:diff_note_on_merge_request, noteable: merge_request, project: project).to_discussion }
describe 'As a user with access to the project' do describe 'As a user with access to the project' do
before do before do
...@@ -74,8 +74,8 @@ feature 'Resolve an open discussion in a merge request by creating an issue', fe ...@@ -74,8 +74,8 @@ feature 'Resolve an open discussion in a merge request by creating an issue', fe
it 'Shows a notice to ask someone else to resolve the discussions' do it 'Shows a notice to ask someone else to resolve the discussions' do
expect(page).to have_content("The discussion at #{merge_request.to_reference}"\ expect(page).to have_content("The discussion at #{merge_request.to_reference}"\
"(discussion #{discussion.first_note.id}) will stay unresolved."\ " (discussion #{discussion.first_note.id}) will stay unresolved."\
"Ask someone with permission to resolve it.") " Ask someone with permission to resolve it.")
end end
end end
end end
...@@ -17,14 +17,17 @@ feature 'Projects > Audit Events', js: true, feature: true 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_title', with: 'laptop'
fill_in 'deploy_key_key', with: 'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzrEJUIR6Y03TCE9rIJ+GqTBvgb8t1jI9h5UBzCLuK4VawOmkLornPqLDrGbm6tcwM/wBrrLvVOqi2HwmkKEIecVO0a64A4rIYScVsXIniHRS6w5twyn1MD3sIbN+socBDcaldECQa2u1dI3tnNVcs8wi77fiRe7RSxePsJceGoheRQgC8AZ510UdIlO+9rjIHUdVN7LLyz512auAfYsgx1OfablkQ/XJcdEwDNgi9imI6nAXhmoKUm1IPLT2yKajTIC64AjLOnE0YyCh6+7RFMpiMyu1qiOCpdjYwTgBRiciNRZCH8xIedyCoAmiUgkUT40XYHwLuwiPJICpkAzp7Q== user@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) visit namespace_project_audit_events_path(project.namespace, project)
expect(page).to have_content('Add deploy key') expect(page).to have_content('Add deploy key')
visit namespace_project_deploy_keys_path(project.namespace, project) visit namespace_project_deploy_keys_path(project.namespace, project)
accept_confirm do
click_link 'Remove' click_link 'Remove'
end
visit namespace_project_audit_events_path(project.namespace, project) visit namespace_project_audit_events_path(project.namespace, project)
...@@ -38,15 +41,13 @@ feature 'Projects > Audit Events', js: true, feature: true do ...@@ -38,15 +41,13 @@ feature 'Projects > Audit Events', js: true, feature: true do
end end
it "appears in the project's audit events" do it "appears in the project's audit events" do
visit namespace_project_path(project.namespace, project) visit namespace_project_settings_members_path(project.namespace, project)
click_link 'Members'
project_member = project.project_member(pete) project_member = project.project_member(pete)
page.within "#project_member_#{project_member.id}" do page.within "#project_member_#{project_member.id}" do
click_button 'Edit access level' click_button 'Developer'
select 'Master', from: 'project_member_access_level' click_link 'Master'
click_button 'Save'
end end
# This is to avoid a Capybara::Poltergeist::MouseEventFailed error # This is to avoid a Capybara::Poltergeist::MouseEventFailed error
......
require 'spec_helper' require 'spec_helper'
describe Gitlab::OtherMarkup, lib: true do describe Gitlab::OtherMarkup, lib: true do
let(:context) { {} }
context "XSS Checks" do context "XSS Checks" do
links = { links = {
'links' => { 'links' => {
file: 'file.rdoc', file: 'file.rdoc',
input: 'XSS[JaVaScriPt:alert(1)]', input: 'XSS[JaVaScriPt:alert(1)]',
output: '<p><a>XSS</a></p>' output: "\n" + '<p><a>XSS</a></p>' + "\n"
} }
} }
links.each do |name, data| links.each do |name, data|
......
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