summaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit')
-rw-r--r--spec/unit/core/guess_spec.rb3
-rw-r--r--spec/unit/core/parser_spec.rb21
-rw-r--r--spec/unit/python/pypi_spec.rb4
-rw-r--r--spec/unit/ruby/parsers/gemfile_lock_spec.rb2
4 files changed, 23 insertions, 7 deletions
diff --git a/spec/unit/core/guess_spec.rb b/spec/unit/core/guess_spec.rb
index c001c8a..058b4f6 100644
--- a/spec/unit/core/guess_spec.rb
+++ b/spec/unit/core/guess_spec.rb
@@ -32,7 +32,7 @@ RSpec.describe Spandx::Core::Guess do
end
end
- pending 'does not contain any duplicate names' do
+ specify 'does not contain any duplicate names' do
items = Hash.new { |hash, key| hash[key] = 0 }
active_licenses.each { |license| items[license.name] += 1 }
expect(items.find_all { |_x, y| y > 1 }).to be_empty
@@ -44,6 +44,7 @@ RSpec.describe Spandx::Core::Guess do
specify { expect(subject.license_for(content)&.id).to eql('MIT') }
end
+ specify { expect(subject.license_for(%w[MIT 0BSD]).id).to eql('MIT AND 0BSD') }
specify { expect(subject.license_for('(0BSD OR MIT)')&.id).to eql('0BSD OR MIT') }
specify { expect(subject.license_for('(BSD-2-Clause OR MIT OR Apache-2.0)')&.id).to eql('BSD-2-Clause OR MIT OR Apache-2.0') }
specify { expect(subject.license_for('(BSD-3-Clause OR GPL-2.0)')&.id).to eql('BSD-3-Clause OR GPL-2.0') }
diff --git a/spec/unit/core/parser_spec.rb b/spec/unit/core/parser_spec.rb
new file mode 100644
index 0000000..9ad5bea
--- /dev/null
+++ b/spec/unit/core/parser_spec.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+RSpec.describe Spandx::Core::Parser do
+ subject { described_class }
+
+ describe '.for' do
+ describe 'when the `composer.lock` file is empty' do
+ let(:empty_file) { fixture_file('empty/composer.lock') }
+ let(:result) { subject.for(empty_file) }
+
+ specify { expect(result).to be(Spandx::Core::Parser::UNKNOWN) }
+ end
+
+ describe 'when the `composer.lock` file is discovered' do
+ let(:lock_file) { fixture_file('composer/composer.lock') }
+ let(:result) { subject.for(lock_file) }
+
+ specify { expect(result).to be_instance_of(Spandx::Php::Parsers::Composer) }
+ end
+ end
+end
diff --git a/spec/unit/python/pypi_spec.rb b/spec/unit/python/pypi_spec.rb
index 9836c9d..cb09c4a 100644
--- a/spec/unit/python/pypi_spec.rb
+++ b/spec/unit/python/pypi_spec.rb
@@ -203,8 +203,4 @@ RSpec.describe Spandx::Python::Pypi do
end
end
end
-
- describe 'PyPI' do
- specify { expect(Spandx::Python::PyPI).to eql(described_class) }
- end
end
diff --git a/spec/unit/ruby/parsers/gemfile_lock_spec.rb b/spec/unit/ruby/parsers/gemfile_lock_spec.rb
index 20f1734..7160033 100644
--- a/spec/unit/ruby/parsers/gemfile_lock_spec.rb
+++ b/spec/unit/ruby/parsers/gemfile_lock_spec.rb
@@ -29,6 +29,4 @@ RSpec.describe Spandx::Ruby::Parsers::GemfileLock do
specify { expect(spandx.meta[:source]).to be_a_kind_of(Bundler::Source) }
end
end
-
- specify { expect(Spandx::Rubygems::Parsers::GemfileLock).to eql(described_class) }
end