2011-10-08 21:36:38 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2015-06-28 20:19:52 +00:00
|
|
|
feature 'Project', feature: true do
|
2015-05-29 23:02:11 +00:00
|
|
|
describe 'description' do
|
|
|
|
let(:project) { create(:project) }
|
|
|
|
let(:path) { namespace_project_path(project.namespace, project) }
|
2011-10-08 21:36:38 +00:00
|
|
|
|
2012-05-27 10:39:57 +00:00
|
|
|
before do
|
2015-05-29 23:02:11 +00:00
|
|
|
login_as(:admin)
|
2012-05-27 10:39:57 +00:00
|
|
|
end
|
|
|
|
|
2015-05-29 23:02:11 +00:00
|
|
|
it 'parses Markdown' do
|
|
|
|
project.update_attribute(:description, 'This is **my** project')
|
|
|
|
visit path
|
|
|
|
expect(page).to have_css('.project-home-desc > p > strong')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'passes through html-pipeline' do
|
|
|
|
project.update_attribute(:description, 'This project is the :poop:')
|
|
|
|
visit path
|
|
|
|
expect(page).to have_css('.project-home-desc > p > img')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'sanitizes unwanted tags' do
|
2015-08-06 15:15:37 +00:00
|
|
|
project.update_attribute(:description, "```\ncode\n```")
|
2015-05-29 23:02:11 +00:00
|
|
|
visit path
|
2015-08-06 15:15:37 +00:00
|
|
|
expect(page).not_to have_css('.project-home-desc code')
|
2015-05-29 23:02:11 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'permits `rel` attribute on links' do
|
|
|
|
project.update_attribute(:description, 'https://google.com/')
|
|
|
|
visit path
|
|
|
|
expect(page).to have_css('.project-home-desc a[rel]')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-10-13 10:24:44 +00:00
|
|
|
describe 'remove forked relationship', js: true do
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project) { create(:project, namespace: user.namespace) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
login_with user
|
|
|
|
create(:forked_project_link, forked_to_project: project)
|
|
|
|
visit edit_namespace_project_path(project.namespace, project)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should remove fork' do
|
2015-10-13 22:04:22 +00:00
|
|
|
expect(page).to have_content 'Remove fork relationship'
|
2015-10-13 10:24:44 +00:00
|
|
|
|
2015-10-13 22:04:22 +00:00
|
|
|
remove_with_confirm('Remove fork relationship', project.path)
|
2015-10-13 10:24:44 +00:00
|
|
|
|
2015-10-18 12:12:50 +00:00
|
|
|
expect(page).to have_content 'The fork relationship has been removed.'
|
2015-10-13 10:24:44 +00:00
|
|
|
expect(project.forked?).to be_falsey
|
2015-10-13 22:04:22 +00:00
|
|
|
expect(page).not_to have_content 'Remove fork relationship'
|
2015-10-13 10:24:44 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-05-29 23:02:11 +00:00
|
|
|
describe 'removal', js: true do
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project) { create(:project, namespace: user.namespace) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
login_with(user)
|
|
|
|
project.team << [user, :master]
|
|
|
|
visit edit_namespace_project_path(project.namespace, project)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should remove project' do
|
2015-10-13 10:24:44 +00:00
|
|
|
expect { remove_with_confirm('Remove project', project.path) }.to change {Project.count}.by(-1)
|
2012-05-27 10:39:57 +00:00
|
|
|
end
|
|
|
|
end
|
2014-10-28 18:02:01 +00:00
|
|
|
|
2016-01-17 18:12:05 +00:00
|
|
|
describe 'project title' do
|
|
|
|
include WaitForAjax
|
|
|
|
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project) { create(:project, namespace: user.namespace) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
login_with(user)
|
|
|
|
project.team.add_user(user, Gitlab::Access::MASTER)
|
|
|
|
visit namespace_project_path(project.namespace, project)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'click toggle and show dropdown', js: true do
|
|
|
|
find('.js-projects-dropdown-toggle').click
|
2016-03-24 16:28:46 +00:00
|
|
|
expect(page).to have_css('.dropdown-menu-projects .dropdown-content li', count: 1)
|
2015-12-28 22:37:03 +00:00
|
|
|
end
|
2015-12-21 20:56:11 +00:00
|
|
|
end
|
|
|
|
|
2016-04-26 08:35:58 +00:00
|
|
|
describe 'project title' do
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project) { create(:project, namespace: user.namespace) }
|
|
|
|
let(:project2) { create(:project, namespace: user.namespace, path: 'test') }
|
|
|
|
let(:issue) { create(:issue, project: project) }
|
|
|
|
|
|
|
|
context 'on issues page', js: true do
|
|
|
|
before do
|
|
|
|
login_with(user)
|
|
|
|
project.team.add_user(user, Gitlab::Access::MASTER)
|
|
|
|
project2.team.add_user(user, Gitlab::Access::MASTER)
|
|
|
|
visit namespace_project_issue_path(project.namespace, project, issue)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'click toggle and show dropdown' do
|
|
|
|
find('.js-projects-dropdown-toggle').click
|
|
|
|
expect(page).to have_css('.dropdown-menu-projects .dropdown-content li', count: 2)
|
|
|
|
|
|
|
|
page.within '.dropdown-menu-projects' do
|
|
|
|
click_link project.name_with_namespace
|
|
|
|
end
|
|
|
|
|
|
|
|
expect(page).to have_content project.name
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-10-13 10:24:44 +00:00
|
|
|
def remove_with_confirm(button_text, confirm_with)
|
|
|
|
click_button button_text
|
|
|
|
fill_in 'confirm_name_input', with: confirm_with
|
2014-10-28 18:02:01 +00:00
|
|
|
click_button 'Confirm'
|
|
|
|
end
|
2011-10-08 21:36:38 +00:00
|
|
|
end
|