Also test against external-issue for deleted projects
This is based on: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/10841
This commit is contained in:
parent
b43cabaf49
commit
31ea72b62e
1 changed files with 17 additions and 5 deletions
|
@ -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')
|
||||
|
|
Loading…
Reference in a new issue