spec/lib/dradis/plugins/projects/export/v2/template_spec.rb in dradis-projects-3.19.0 vs spec/lib/dradis/plugins/projects/export/v2/template_spec.rb in dradis-projects-3.20.0

- old
+ new

@@ -11,42 +11,54 @@ ).export end context 'exporting a project' do before do - node = create(:node, project: project) - issue = create(:issue, text: 'Issue 1', node: project.issue_library) + @node = create(:node, project: project) + @issue = create(:issue, text: 'Issue 1', node: project.issue_library) end context 'with comments in an issue' do before do - create(:comment, content: 'A comment on an issue', commentable: issue) + create(:comment, content: 'A comment on an issue', commentable: @issue) end it 'exports comments in the issue' do expect(export).to include('A comment on an issue') end end context 'with comments in a note' do before do - note = create(:note, text: 'Note 1', node: node) + note = create(:note, text: 'Note 1', node: @node) create(:comment, content: 'A comment on a note', commentable: note) end it 'exports comments in the note' do expect(export).to include('A comment on a note') end end context 'with comments in an evidence' do before do - evidence = create(:evidence, text: 'Test evidence', node: node, issue: issue) + evidence = create(:evidence, content: 'Test evidence', node: @node, issue: @issue) create(:comment, content: 'A comment on an evidence', commentable: evidence) end it 'exports comments in the evidence' do expect(export).to include('A comment on an evidence') + end + end + + context 'with comments with a deleted author' do + before do + note = create(:note, text: 'Note 1', node: @node) + comment = create(:comment, content: 'Deleted user', commentable: note) + comment.update_attribute :user, nil + end + + it 'exports the comment without errors' do + expect(export).to include('Deleted user') end end end end