summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorCan Eldem <eldemcan@users.noreply.github.com>2020-05-18 10:04:25 +0100
committerGitHub <noreply@github.com>2020-05-18 10:04:25 +0100
commitbaa882c452ea6311b4c934ca388e04757c7c436d (patch)
tree2322da54fb505427915c65f296eb1a88afdd533b /spec
parent6b392af62854d28b9f12fe292e21b79baa25c63b (diff)
parentf1cbf51f1a185d70c45959c3e2199b29ccbacd1d (diff)
Merge pull request #20 from spandx/bugs-bunnyv0.13.2
Fix bugs.
Diffstat (limited to 'spec')
-rw-r--r--spec/fixtures/empty/composer.lock0
m---------spec/fixtures/spdx0
-rw-r--r--spec/integration/core/git_spec.rb2
-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
7 files changed, 23 insertions, 9 deletions
diff --git a/spec/fixtures/empty/composer.lock b/spec/fixtures/empty/composer.lock
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/spec/fixtures/empty/composer.lock
diff --git a/spec/fixtures/spdx b/spec/fixtures/spdx
-Subproject 44837a94516118d3adbc3c2241f9e2ec818d4a9
+Subproject 3c4b2f1675ef25d307a8f4aa61d75ec5a2c3976
diff --git a/spec/integration/core/git_spec.rb b/spec/integration/core/git_spec.rb
index 12d4a42..186c5b7 100644
--- a/spec/integration/core/git_spec.rb
+++ b/spec/integration/core/git_spec.rb
@@ -44,6 +44,4 @@ RSpec.describe Spandx::Core::Git do
it { expect(shell).to have_received(:system).with('git', 'pull', '--no-rebase', '--quiet', 'origin', 'master') }
end
end
-
- specify { expect(Spandx::Core::Database).to eql(described_class) }
end
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