diff options
| author | mo khan <mo.khan@gmail.com> | 2020-05-07 17:29:24 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-05-07 17:29:24 -0600 |
| commit | 74f4dfd70afdbf2d73905a00dda32bd3abef299a (patch) | |
| tree | d13925d8c1be6f63b160af77a95191d126e00e86 /spec/unit | |
| parent | cc9eda11425e6f6ec3243fbcd768c4e2a37adf2a (diff) | |
Remove parens and fix bug with squeeze
Diffstat (limited to 'spec/unit')
| -rw-r--r-- | spec/unit/core/guess_spec.rb | 22 | ||||
| -rw-r--r-- | spec/unit/spdx/composite_license_spec.rb | 11 |
2 files changed, 18 insertions, 15 deletions
diff --git a/spec/unit/core/guess_spec.rb b/spec/unit/core/guess_spec.rb index 63f0bf2..c001c8a 100644 --- a/spec/unit/core/guess_spec.rb +++ b/spec/unit/core/guess_spec.rb @@ -44,20 +44,20 @@ RSpec.describe Spandx::Core::Guess do specify { expect(subject.license_for(content)&.id).to eql('MIT') } end - 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)') } - specify { expect(subject.license_for('(MIT AND CC-BY-3.0)')&.id).to eql('(MIT AND CC-BY-3.0)') } - specify { expect(subject.license_for('(MIT AND Zlib)')&.id).to eql('(MIT AND Zlib)') } - specify { expect(subject.license_for('(MIT OR Apache-2.0)')&.id).to eql('(MIT OR Apache-2.0)') } - specify { expect(subject.license_for('(MIT OR CC0-1.0)')&.id).to eql('(MIT OR CC0-1.0)') } - specify { expect(subject.license_for('(MIT OR GPL-3.0)')&.id).to eql('(MIT OR GPL-3.0)') } - specify { expect(subject.license_for('(WTFPL OR MIT)')&.id).to eql('(WTFPL OR MIT)') } + 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') } + specify { expect(subject.license_for('(MIT AND CC-BY-3.0)')&.id).to eql('MIT AND CC-BY-3.0') } + specify { expect(subject.license_for('(MIT AND Zlib)')&.id).to eql('MIT AND Zlib') } + specify { expect(subject.license_for('(MIT OR Apache-2.0)')&.id).to eql('MIT OR Apache-2.0') } + specify { expect(subject.license_for('(MIT OR CC0-1.0)')&.id).to eql('MIT OR CC0-1.0') } + specify { expect(subject.license_for('(MIT OR GPL-3.0)')&.id).to eql('MIT OR GPL-3.0') } + specify { expect(subject.license_for('(WTFPL OR MIT)')&.id).to eql('WTFPL OR MIT') } specify { expect(subject.license_for('Apache 2.0')&.id).to eql('Apache-2.0') } - specify { expect(subject.license_for('BSD-3-Clause OR MIT')&.id).to eql('(BSD-3-Clause OR MIT)') } + specify { expect(subject.license_for('BSD-3-Clause OR MIT')&.id).to eql('BSD-3-Clause OR MIT') } specify { expect(subject.license_for('BSD-like')&.id).to eql('Nonstandard') } specify { expect(subject.license_for('Common Public License Version 1.0')&.id).to eql('CPL-1.0') } - specify { expect(subject.license_for('MIT or GPLv3')&.id).to eql('(MIT OR Nonstandard)') } + specify { expect(subject.license_for('MIT or GPLv3')&.id).to eql('MIT OR Nonstandard') } pending { expect(subject.license_for('MIT/X11')&.id).to eql('X11') } end end diff --git a/spec/unit/spdx/composite_license_spec.rb b/spec/unit/spdx/composite_license_spec.rb index 84dca0c..5baf578 100644 --- a/spec/unit/spdx/composite_license_spec.rb +++ b/spec/unit/spdx/composite_license_spec.rb @@ -1,6 +1,9 @@ +# frozen_string_literal: true + RSpec.describe Spandx::Spdx::CompositeLicense do - context ".from_expression" do + describe '.from_expression' do subject { described_class.from_expression(expression, catalogue) } + let(:catalogue) { ::Spandx::Spdx::Catalogue.from_file(fixture_file('spdx/json/licenses.json')) } before do @@ -10,7 +13,7 @@ RSpec.describe Spandx::Spdx::CompositeLicense do context 'when parsing a simple binary expression' do let(:expression) { '(0BSD OR MIT)' } - specify { expect(subject.id).to eql(expression) } + specify { expect(subject.id).to eql('0BSD OR MIT') } specify { expect(subject.name).to eql("#{catalogue['0BSD'].name} OR #{catalogue['MIT'].name}") } specify { expect(subject).to be_kind_of(::Spandx::Spdx::License) } end @@ -18,7 +21,7 @@ RSpec.describe Spandx::Spdx::CompositeLicense do context 'when parsing an expression with a valid and an invalid license id' do let(:expression) { 'MIT or GPLv3' } - specify { expect(subject.id).to eql("(MIT OR Nonstandard)") } + specify { expect(subject.id).to eql('MIT OR Nonstandard') } specify { expect(subject.name).to eql("#{catalogue['MIT'].name} OR GPLv3") } specify { expect(subject).to be_kind_of(::Spandx::Spdx::License) } end @@ -39,7 +42,7 @@ RSpec.describe Spandx::Spdx::CompositeLicense do context 'when parsing a binary expression with an id that is similar to another' do let(:expression) { '(MIT OR CC0-1.0)' } - specify { expect(subject.id).to eql(expression) } + specify { expect(subject.id).to eql('MIT OR CC0-1.0') } specify { expect(subject.name).to eql("#{catalogue['MIT'].name} OR #{catalogue['CC0-1.0'].name}") } specify { expect(subject).to be_kind_of(::Spandx::Spdx::License) } end |
