summaryrefslogtreecommitdiff
path: root/spec/unit/php
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-04-11 18:28:26 -0600
committermo khan <mo.khan@gmail.com>2020-04-11 18:28:26 -0600
commitea564d014efed0dba293817bc75dede3b3591b76 (patch)
treedbb71bbe7aa1850988df25425716ac475cfb313d /spec/unit/php
parent2c649ed6529f423b4c672fb6b1f0fee0e1731772 (diff)
Extract packagist gateway
Diffstat (limited to 'spec/unit/php')
-rw-r--r--spec/unit/php/parsers/composer_spec.rb26
1 files changed, 13 insertions, 13 deletions
diff --git a/spec/unit/php/parsers/composer_spec.rb b/spec/unit/php/parsers/composer_spec.rb
index a3771c6..d565935 100644
--- a/spec/unit/php/parsers/composer_spec.rb
+++ b/spec/unit/php/parsers/composer_spec.rb
@@ -1,24 +1,24 @@
# frozen_string_literal: true
RSpec.describe Spandx::Php::Parsers::Composer do
- subject { described_class.new(catalogue: catalogue) }
-
- let(:catalogue) { Spandx::Spdx::Catalogue.from_file(fixture_file('spdx/json/licenses.json')) }
+ subject { described_class.new }
describe '#parse small lock file' do
let(:lockfile) { fixture_file('composer/composer.lock') }
- let(:result) { subject.parse(lockfile) }
+ let(:expected_array) do
+ [
+ 'doctrine/instantiator@1.3.0',
+ 'hamcrest/hamcrest-php@v2.0.0',
+ 'mockery/mockery@1.3.1',
+ 'phpdocumentor/reflection-common@2.0.0',
+ 'phpdocumentor/type-resolver@1.0.1',
+ 'symfony/polyfill-ctype@v1.14.0',
+ 'webmozart/assert@1.7.0',
+ ]
+ end
- expected_array = ['phpdocumentor/reflection-common@2.0.0',
- 'phpdocumentor/type-resolver@1.0.1',
- 'symfony/polyfill-ctype@v1.14.0',
- 'webmozart/assert@1.7.0',
- 'doctrine/instantiator@1.3.0',
- 'hamcrest/hamcrest-php@v2.0.0',
- 'mockery/mockery@1.3.1']
+ let(:result) { subject.parse(lockfile) }
specify { expect(result.map { |x| "#{x.name}@#{x.version}" }) .to match_array(expected_array) }
-
- specify { expect(result.map(&:licenses).map(&:first).compact.map(&:id).uniq).to match_array(['MIT', 'BSD-3-Clause']) }
end
end