Commit 31ea72b6 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Also test against external-issue for deleted projects

This is based on:

https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/10841
parent b43cabaf
......@@ -43,12 +43,24 @@ describe Banzai::Redactor do
end
context 'when project is in pending delete' do
let!(:issue) { create(:issue, project: project) }
let(:redactor) { described_class.new(project, user) }
before do
project.update(pending_delete: true)
end
it 'redacts an issue attached' do
project.pending_delete = true
project.save
issue = create(:issue, project: project)
redactor = described_class.new(project, user)
doc = Nokogiri::HTML.fragment("<a class='gfm' data-reference-type='issue' data-project=\"#{project.id}\" data-issue=\"#{issue.id}\">foo</a>")
doc = Nokogiri::HTML.fragment("<a class='gfm' data-reference-type='issue' data-issue='#{issue.id}'>foo</a>")
redactor.redact([doc])
expect(doc.to_html).to eq('foo')
end
it 'redacts an external issue' do
doc = Nokogiri::HTML.fragment("<a class='gfm' data-reference-type='issue' data-external-issue='#{issue.id}' data-project='#{project.id}'>foo</a>")
redactor.redact([doc])
expect(doc.to_html).to eq('foo')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment