2011-10-08 17:36:38 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-08-07 08:21:28 -04:00
|
|
|
feature 'Project' do
|
2017-07-26 08:21:53 -04:00
|
|
|
describe 'creating from template' do
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:template) { Gitlab::ProjectTemplate.find(:rails) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in user
|
|
|
|
visit new_project_path
|
|
|
|
end
|
|
|
|
|
2017-08-01 08:34:11 -04:00
|
|
|
it "allows creation from templates" do
|
2017-08-07 09:32:43 -04:00
|
|
|
page.choose(template.name)
|
2017-07-26 08:21:53 -04:00
|
|
|
fill_in("project_path", with: template.name)
|
|
|
|
|
|
|
|
page.within '#content-body' do
|
|
|
|
click_button "Create project"
|
|
|
|
end
|
|
|
|
|
2017-08-07 09:32:43 -04:00
|
|
|
expect(page).to have_content 'This project Loading..'
|
2017-07-26 08:21:53 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-05-29 19:02:11 -04:00
|
|
|
describe 'description' do
|
2017-03-28 17:13:16 -04:00
|
|
|
let(:project) { create(:project, :repository) }
|
2017-07-06 12:20:50 -04:00
|
|
|
let(:path) { project_path(project) }
|
2011-10-08 17:36:38 -04:00
|
|
|
|
2012-05-27 06:39:57 -04:00
|
|
|
before do
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in(create(:admin))
|
2012-05-27 06:39:57 -04:00
|
|
|
end
|
|
|
|
|
2015-05-29 19:02:11 -04: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
|
2017-02-27 23:44:34 -05:00
|
|
|
expect(page).to have_css('.project-home-desc > p > gl-emoji')
|
2015-05-29 19:02:11 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'sanitizes unwanted tags' do
|
2015-08-06 11:15:37 -04:00
|
|
|
project.update_attribute(:description, "```\ncode\n```")
|
2015-05-29 19:02:11 -04:00
|
|
|
visit path
|
2015-08-06 11:15:37 -04:00
|
|
|
expect(page).not_to have_css('.project-home-desc code')
|
2015-05-29 19:02:11 -04: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 06:24:44 -04:00
|
|
|
describe 'remove forked relationship', js: true do
|
|
|
|
let(:user) { create(:user) }
|
2017-08-02 15:55:11 -04:00
|
|
|
let(:project) { create(:project, namespace: user.namespace) }
|
2015-10-13 06:24:44 -04:00
|
|
|
|
|
|
|
before do
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in user
|
2015-10-13 06:24:44 -04:00
|
|
|
create(:forked_project_link, forked_to_project: project)
|
2017-07-06 12:20:50 -04:00
|
|
|
visit edit_project_path(project)
|
2015-10-13 06:24:44 -04:00
|
|
|
end
|
|
|
|
|
2016-07-25 14:16:19 -04:00
|
|
|
it 'removes fork' do
|
2015-10-13 18:04:22 -04:00
|
|
|
expect(page).to have_content 'Remove fork relationship'
|
2015-10-13 06:24:44 -04:00
|
|
|
|
2015-10-13 18:04:22 -04:00
|
|
|
remove_with_confirm('Remove fork relationship', project.path)
|
2015-10-13 06:24:44 -04:00
|
|
|
|
2015-10-18 08:12:50 -04:00
|
|
|
expect(page).to have_content 'The fork relationship has been removed.'
|
2015-10-13 06:24:44 -04:00
|
|
|
expect(project.forked?).to be_falsey
|
2015-10-13 18:04:22 -04:00
|
|
|
expect(page).not_to have_content 'Remove fork relationship'
|
2015-10-13 06:24:44 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-05-29 19:02:11 -04:00
|
|
|
describe 'removal', js: true do
|
2017-03-15 00:05:22 -04:00
|
|
|
let(:user) { create(:user, username: 'test', name: 'test') }
|
2017-08-02 15:55:11 -04:00
|
|
|
let(:project) { create(:project, namespace: user.namespace, name: 'project1') }
|
2015-05-29 19:02:11 -04:00
|
|
|
|
|
|
|
before do
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in(user)
|
2015-05-29 19:02:11 -04:00
|
|
|
project.team << [user, :master]
|
2017-07-06 12:20:50 -04:00
|
|
|
visit edit_project_path(project)
|
2015-05-29 19:02:11 -04:00
|
|
|
end
|
|
|
|
|
2016-09-02 08:15:18 -04:00
|
|
|
it 'removes a project' do
|
2015-10-13 06:24:44 -04:00
|
|
|
expect { remove_with_confirm('Remove project', project.path) }.to change {Project.count}.by(-1)
|
2017-03-15 00:05:22 -04:00
|
|
|
expect(page).to have_content "Project 'test / project1' will be deleted."
|
2016-09-02 08:15:18 -04:00
|
|
|
expect(Project.all.count).to be_zero
|
|
|
|
expect(project.issues).to be_empty
|
|
|
|
expect(project.merge_requests).to be_empty
|
2012-05-27 06:39:57 -04:00
|
|
|
end
|
|
|
|
end
|
2014-10-28 14:02:01 -04:00
|
|
|
|
2016-01-17 13:12:05 -05:00
|
|
|
describe 'project title' do
|
|
|
|
let(:user) { create(:user) }
|
2017-08-02 15:55:11 -04:00
|
|
|
let(:project) { create(:project, namespace: user.namespace) }
|
2016-01-17 13:12:05 -05:00
|
|
|
|
|
|
|
before do
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in(user)
|
2016-09-16 11:54:21 -04:00
|
|
|
project.add_user(user, Gitlab::Access::MASTER)
|
2017-07-06 12:20:50 -04:00
|
|
|
visit project_path(project)
|
2016-01-17 13:12:05 -05:00
|
|
|
end
|
|
|
|
|
2016-07-25 14:16:19 -04:00
|
|
|
it 'clicks toggle and shows dropdown', js: true do
|
2016-01-17 13:12:05 -05:00
|
|
|
find('.js-projects-dropdown-toggle').click
|
2016-03-24 12:28:46 -04:00
|
|
|
expect(page).to have_css('.dropdown-menu-projects .dropdown-content li', count: 1)
|
2015-12-28 17:37:03 -05:00
|
|
|
end
|
2015-12-21 15:56:11 -05:00
|
|
|
end
|
|
|
|
|
2016-04-26 04:35:58 -04:00
|
|
|
describe 'project title' do
|
|
|
|
let(:user) { create(:user) }
|
2017-08-02 15:55:11 -04:00
|
|
|
let(:project) { create(:project, namespace: user.namespace) }
|
|
|
|
let(:project2) { create(:project, namespace: user.namespace, path: 'test') }
|
2016-04-26 04:35:58 -04:00
|
|
|
let(:issue) { create(:issue, project: project) }
|
|
|
|
|
|
|
|
context 'on issues page', js: true do
|
|
|
|
before do
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in(user)
|
2016-09-16 11:54:21 -04:00
|
|
|
project.add_user(user, Gitlab::Access::MASTER)
|
|
|
|
project2.add_user(user, Gitlab::Access::MASTER)
|
2017-07-06 12:20:50 -04:00
|
|
|
visit project_issue_path(project, issue)
|
2016-04-26 04:35:58 -04:00
|
|
|
end
|
|
|
|
|
2016-07-25 14:16:19 -04:00
|
|
|
it 'clicks toggle and shows dropdown' do
|
2016-04-26 04:35:58 -04:00
|
|
|
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
|
|
|
|
|
2016-08-22 12:19:39 -04:00
|
|
|
describe 'tree view (default view is set to Files)' do
|
|
|
|
let(:user) { create(:user, project_view: 'files') }
|
|
|
|
let(:project) { create(:forked_project_with_submodules) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
project.team << [user, :master]
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in user
|
2017-07-06 12:20:50 -04:00
|
|
|
visit project_path(project)
|
2016-08-22 12:19:39 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'has working links to files' do
|
|
|
|
click_link('PROCESS.md')
|
|
|
|
|
|
|
|
expect(page.status_code).to eq(200)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'has working links to directories' do
|
|
|
|
click_link('encoding')
|
|
|
|
|
|
|
|
expect(page.status_code).to eq(200)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'has working links to submodules' do
|
|
|
|
click_link('645f6c4c')
|
|
|
|
|
|
|
|
expect(page.status_code).to eq(200)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-10-13 06:24:44 -04:00
|
|
|
def remove_with_confirm(button_text, confirm_with)
|
|
|
|
click_button button_text
|
|
|
|
fill_in 'confirm_name_input', with: confirm_with
|
2014-10-28 14:02:01 -04:00
|
|
|
click_button 'Confirm'
|
|
|
|
end
|
2011-10-08 17:36:38 -04:00
|
|
|
end
|