diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-06-02 18:19:01 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-06-02 18:19:01 +0000 |
commit | 34d176ad577ea421c99c87a54196deda92f796e8 (patch) | |
tree | 3ea0626b8d56d3c14309ccf07e6c3fcb4fd6f465 /spec/features/projects_spec.rb | |
parent | d85a7437a5651a93fc20d9bf7f183293151adb77 (diff) | |
parent | 9e7a9c63a59f4e673271b3600b735e3fa6702432 (diff) | |
download | gitlab-ce-34d176ad577ea421c99c87a54196deda92f796e8.tar.gz |
Merge branch 'rs-more-nofollow' into 'master'
Render Group and Project descriptions with our Markdown pipeline
Continuation of !727, this ensures external links in these fields also get `rel="nofollow"` added.
Bonus: Emoji now works in them! :sparkles:
See merge request !735
Diffstat (limited to 'spec/features/projects_spec.rb')
-rw-r--r-- | spec/features/projects_spec.rb | 56 |
1 files changed, 44 insertions, 12 deletions
diff --git a/spec/features/projects_spec.rb b/spec/features/projects_spec.rb index cae11be7cdd..56523f6e1a8 100644 --- a/spec/features/projects_spec.rb +++ b/spec/features/projects_spec.rb @@ -1,24 +1,56 @@ require 'spec_helper' -describe "Projects", feature: true, js: true do - before { login_as :user } +feature 'Project' do + describe 'description' do + let(:project) { create(:project) } + let(:path) { namespace_project_path(project.namespace, project) } - describe "DELETE /projects/:id" do before do - @project = create(:project, namespace: @user.namespace) - @project.team << [@user, :master] - visit edit_namespace_project_path(@project.namespace, @project) + login_as(:admin) end - it "should remove project" do + 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 expect { remove_project }.to change {Project.count}.by(-1) end it 'should delete the project from disk' do - expect(GitlabShellWorker).to( - receive(:perform_async).with(:remove_repository, - /#{@project.path_with_namespace}/) - ).twice + expect(GitlabShellWorker).to receive(:perform_async). + with(:remove_repository, /#{project.path_with_namespace}/).twice remove_project end @@ -26,7 +58,7 @@ describe "Projects", feature: true, js: true do def remove_project click_link "Remove project" - fill_in 'confirm_name_input', with: @project.path + fill_in 'confirm_name_input', with: project.path click_button 'Confirm' end end |