Skip to content
Snippets Groups Projects
Commit 442a0663 authored by Robert Speicher's avatar Robert Speicher
Browse files

Add feature specs for Project and Group description rendering

parent 023dd290
No related branches found
No related tags found
No related merge requests found
require 'spec_helper'
feature 'Group' do
describe 'description' do
let(:group) { create(:group) }
let(:path) { group_path(group) }
before do
login_as(:admin)
end
it 'parses Markdown' do
group.update_attribute(:description, 'This is **my** group')
visit path
expect(page).to have_css('.description > p > strong')
end
it 'passes through html-pipeline' do
group.update_attribute(:description, 'This group is the :poop:')
visit path
expect(page).to have_css('.description > p > img')
end
it 'sanitizes unwanted tags' do
group.update_attribute(:description, '# Group Description')
visit path
expect(page).not_to have_css('.description h1')
end
it 'permits `rel` attribute on links' do
group.update_attribute(:description, 'https://google.com/')
visit path
expect(page).to have_css('.description a[rel]')
end
end
end
Loading
@@ -18,11 +18,13 @@ require 'erb'
Loading
@@ -18,11 +18,13 @@ require 'erb'
# -> `gfm_with_options` helper # -> `gfm_with_options` helper
# -> HTML::Pipeline # -> HTML::Pipeline
# -> Sanitize # -> Sanitize
# -> RelativeLink
# -> Emoji # -> Emoji
# -> Table of Contents # -> Table of Contents
# -> Autolinks # -> Autolinks
# -> Rinku (http, https, ftp) # -> Rinku (http, https, ftp)
# -> Other schemes # -> Other schemes
# -> ExternalLink
# -> References # -> References
# -> TaskList # -> TaskList
# -> `html_safe` # -> `html_safe`
Loading
Loading
require 'spec_helper' require 'spec_helper'
   
describe "Projects", feature: true, js: true do feature 'Project' do
before { login_as :user } describe 'description' do
let(:project) { create(:project) }
let(:path) { namespace_project_path(project.namespace, project) }
   
describe "DELETE /projects/:id" do
before do before do
@project = create(:project, namespace: @user.namespace) login_as(:admin)
@project.team << [@user, :master]
visit edit_namespace_project_path(@project.namespace, @project)
end 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) expect { remove_project }.to change {Project.count}.by(-1)
end end
   
it 'should delete the project from disk' do it 'should delete the project from disk' do
expect(GitlabShellWorker).to( expect(GitlabShellWorker).to receive(:perform_async).
receive(:perform_async).with(:remove_repository, with(:remove_repository, /#{project.path_with_namespace}/).twice
/#{@project.path_with_namespace}/)
).twice
   
remove_project remove_project
end end
Loading
@@ -26,7 +58,7 @@ describe "Projects", feature: true, js: true do
Loading
@@ -26,7 +58,7 @@ describe "Projects", feature: true, js: true do
   
def remove_project def remove_project
click_link "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' click_button 'Confirm'
end end
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment