diff options
| author | mo khan <mo.khan@gmail.com> | 2020-05-22 09:28:44 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-05-25 18:31:06 -0600 |
| commit | 1ca2a951d05480759af1668ed586793ff5d36a26 (patch) | |
| tree | ca16267ec26b1d8c3b1a1346a1ab9e8689992116 /spec/unit/java | |
| parent | f8092c7f0ad26d04c8137b3b7d4faea5508a53ce (diff) | |
Convert from using string paths to using Pathname
* Extract a ./bin/run script
* Extract defintion for NEWLINE
* Add specs for matching yarn.lock
* Add specs for Report
* Convert package_manager to pathname
* Display path in report
* matches? to match?
Diffstat (limited to 'spec/unit/java')
| -rw-r--r-- | spec/unit/java/parsers/maven_spec.rb | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/spec/unit/java/parsers/maven_spec.rb b/spec/unit/java/parsers/maven_spec.rb index 7dda40c..bcd3036 100644 --- a/spec/unit/java/parsers/maven_spec.rb +++ b/spec/unit/java/parsers/maven_spec.rb @@ -1,29 +1,25 @@ # frozen_string_literal: true RSpec.describe Spandx::Java::Parsers::Maven do - subject { described_class.new } - describe '#parse' do context 'when parsing a simple-pom.xml' do - let(:lockfile) { fixture_file('maven/simple-pom.xml') } - - let(:because) { subject.parse(lockfile) } + subject { described_class.new.parse(fixture_file('maven/simple-pom.xml')) } - specify { expect(because[0].name).to eql('junit:junit') } - specify { expect(because[0].version).to eql('3.8.1') } + 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 - let(:lockfile) { fixture_file('maven/invalid-spec-url-pom.xml') } - - let(:because) { subject.parse(lockfile) } + subject { described_class.new.parse(fixture_file('maven/invalid-spec-url-pom.xml')) } - specify { expect(because[0].name).to eql('${project.groupId}:model') } + specify { expect(subject[0].name).to eql('${project.groupId}:model') } end end - describe '.matches?' do - specify { expect(subject.matches?('pom.xml')).to be(true) } - specify { expect(subject.matches?('sitemap.xml')).to be(false) } + 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 |
