2011-10-08 17:36:38 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2015-05-29 19:02:11 -04:00
|
|
|
feature 'Project' do
|
|
|
|
describe 'description' do
|
|
|
|
let(:project) { create(:project) }
|
|
|
|
let(:path) { namespace_project_path(project.namespace, project) }
|
2011-10-08 17:36:38 -04:00
|
|
|
|
2012-05-27 06:39:57 -04:00
|
|
|
before do
|
2015-05-29 19:02:11 -04:00
|
|
|
login_as(: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
|
|
|
|
expect(page).to have_css('.project-home-desc > p > img')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'sanitizes unwanted tags' do
|
|
|
|
project.update_attribute(:description, '# Project Description')
|
|
|
|
visit path
|
|
|
|
expect(page).not_to have_css('.project-home-desc h1')
|
|
|
|
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
|
|
|
|
|
|
|
|
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
|
2014-10-28 14:02:01 -04:00
|
|
|
expect { remove_project }.to change {Project.count}.by(-1)
|
2012-05-27 06:39:57 -04:00
|
|
|
end
|
|
|
|
end
|
2014-10-28 14:02:01 -04:00
|
|
|
|
|
|
|
def remove_project
|
|
|
|
click_link "Remove project"
|
2015-05-29 19:02:11 -04:00
|
|
|
fill_in 'confirm_name_input', with: project.path
|
2014-10-28 14:02:01 -04:00
|
|
|
click_button 'Confirm'
|
|
|
|
end
|
2011-10-08 17:36:38 -04:00
|
|
|
end
|