Sha256: a18a2d96d26184342fb86a61ec06113218faed3a0ebbe7a7e5ebb20f8e34d649

Contents?: true

Size: 1.33 KB

Versions: 8

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

module LicenseFinder
  describe MavenPackage do
    subject do
      described_class.new(
        "artifactId" => "hamcrest-core",
        "version" => "4.11",
        "licenses" => [{ "name" => "MIT" }]
      )
    end

    its(:name) { should == "hamcrest-core" }
    its(:version) { should == "4.11" }
    its(:summary) { should == "" }
    its(:description) { should == "" }
    its(:homepage) { should == "" }
    its(:groups) { should == [] } # no way to get groups from maven?
    its(:children) { should == [] } # no way to get children from maven?
    its(:install_path) { should be_nil }
    its(:package_manager) { should eq 'Maven' }

    describe "#license_names_from_spec" do
      it "returns the license" do
        expect(subject.license_names_from_spec).to eq ["MIT"]
      end

      context "when there are no licenses" do
        subject { described_class.new({}) }

        it "is empty" do
          expect(subject.license_names_from_spec).to be_empty
        end
      end

      context "when there are multiple licenses" do
        subject do
          described_class.new(
            "licenses" => [{ "name" => "1" }, { "name" => "2" }]
          )
        end

        it "returns multiple licenses" do
          expect(subject.license_names_from_spec).to eq ['1', '2']
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
license_finder-2.1.2 spec/lib/license_finder/package_managers/maven_package_spec.rb
license_finder-2.1.1 spec/lib/license_finder/package_managers/maven_package_spec.rb
license_finder-2.1.0 spec/lib/license_finder/package_managers/maven_package_spec.rb
license_finder-2.1.0.rc9 spec/lib/license_finder/package_managers/maven_package_spec.rb
license_finder-2.1.0.rc8 spec/lib/license_finder/package_managers/maven_package_spec.rb
license_finder-2.1.0.rc7 spec/lib/license_finder/package_managers/maven_package_spec.rb
license_finder-2.1.0.rc6 spec/lib/license_finder/package_managers/maven_package_spec.rb
license_finder-2.1.0.rc5 spec/lib/license_finder/package_managers/maven_package_spec.rb