summaryrefslogtreecommitdiff
path: root/spec/unit/java/parsers/maven_spec.rb
blob: bcd3036a29003bf97b227c5f18726e7ebf6ed9e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

RSpec.describe Spandx::Java::Parsers::Maven do
  describe '#parse' do
    context 'when parsing a simple-pom.xml' do
      subject { described_class.new.parse(fixture_file('maven/simple-pom.xml')) }

      specify { expect(subject[0].name).to eql('junit:junit') }
      specify { expect(subject[0].version).to eql('3.8.1') }
    end

    context 'when parsing an invlid pom.xml' do
      subject { described_class.new.parse(fixture_file('maven/invalid-spec-url-pom.xml')) }

      specify { expect(subject[0].name).to eql('${project.groupId}:model') }
    end
  end

  describe '#match?' do
    it { is_expected.to be_match(to_path('pom.xml')) }
    it { is_expected.to be_match(to_path('/root/pom.xml')) }
    it { is_expected.not_to be_match(to_path('sitemap.xml')) }
    it { is_expected.not_to be_match(to_path('/root/notpom.xml')) }
  end
end