Sha256: 445ffd989201faa943eef271e44f8c08e0385075f59dc6727cdbcac4eef109b7

Contents?: true

Size: 1.53 KB

Versions: 12

Compression:

Stored size: 1.53 KB

Contents

require 'rails_helper'

describe Dradis::Plugins::Projects::Upload::V2::Template::Importer do
  let(:project) { create(:project) }
  let(:user) { create(:user) }
  let(:importer_class) { Dradis::Plugins::Projects::Upload::Template }
  let(:file_path) do
    File.join(
      File.dirname(__FILE__),
      '../../../../../../',
      'fixtures',
      'files',
      'with_comments.xml'
    )
  end

  context 'uploading a template with comments' do
    before do
      importer = importer_class::Importer.new(
        default_user_id: user.id,
        plugin: importer_class,
        project_id: project.id
      )

      importer.import(file: file_path)
    end

    let(:node) { project.nodes.find_by(label: 'Node 1') }

    it 'imports comments in issues' do
      issue = project.issues.first
      expect(issue.comments.first.content).to include('A comment on an issue')
    end

    it 'imports comments in notes' do
      note = node.notes.first
      expect(note.comments.first.content).to include('A comment on a note')
    end

    it 'imports comments in evidence' do
      evidence = node.evidence.first
      expect(evidence.comments.first.content).to include('A comment on an evidence')
    end

    it 'imports comments without user' do
      issue = project.issues.first
      note = node.notes.first
      evidence = node.evidence.first

      aggregate_failures do
        expect(issue.comments.first.user).to be_nil
        expect(note.comments.first.user).to be_nil
        expect(evidence.comments.first.user).to be_nil
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
dradis-projects-4.7.0 spec/lib/dradis/plugins/projects/upload/v2/template_spec.rb
dradis-projects-4.6.0 spec/lib/dradis/plugins/projects/upload/v2/template_spec.rb
dradis-projects-4.5.0 spec/lib/dradis/plugins/projects/upload/v2/template_spec.rb
dradis-projects-4.4.0 spec/lib/dradis/plugins/projects/upload/v2/template_spec.rb
dradis-projects-4.3.0 spec/lib/dradis/plugins/projects/upload/v2/template_spec.rb
dradis-projects-4.2.0 spec/lib/dradis/plugins/projects/upload/v2/template_spec.rb
dradis-projects-4.1.2.1 spec/lib/dradis/plugins/projects/upload/v2/template_spec.rb
dradis-projects-4.1.1 spec/lib/dradis/plugins/projects/upload/v2/template_spec.rb
dradis-projects-4.0.0 spec/lib/dradis/plugins/projects/upload/v2/template_spec.rb
dradis-projects-3.22.0 spec/lib/dradis/plugins/projects/upload/v2/template_spec.rb
dradis-projects-3.21.0 spec/lib/dradis/plugins/projects/upload/v2/template_spec.rb
dradis-projects-3.20.0 spec/lib/dradis/plugins/projects/upload/v2/template_spec.rb