Sha256: a968e192af19f06dabba7e9f28f6dc3229092528b94b00c6efda4f59b40fa940

Contents?: true

Size: 1.91 KB

Versions: 4

Compression:

Stored size: 1.91 KB

Contents

require 'spec_helper'

module LicenseFinder
  describe GradlePackage do
    subject do
      described_class.new(
        {
          "name" => "ch.qos.logback:logback-classic:1.1.1",
          "file" => ["logback-classic-1.1.1.jar"],
          "license" => [
            { "name" => "Eclipse Public License - v 1.0", "url"=>"http://www.eclipse.org/legal/epl-v10.html"}
          ]
        }
      )
    end

    it_behaves_like "it conforms to interface required by PackageSaver"

    its(:name) { should == "logback-classic" }
    its(:version) { should == "1.1.1" }
    its(:description) { should == "" }

    describe "#license" do
      it "returns the license if found" do
        subject.license.name.should == "Eclipse Public License - v 1.0"
      end

      context "when there are multiple licenses" do
        subject do
          described_class.new(
            {
              "name" => "ch.qos.logback:logback-classic:1.1.1",
              "file" => ["logback-classic-1.1.1.jar"],
              "license" => [
                { "name" => "Eclipse Public License - v 1.0", "url"=>"http://www.eclipse.org/legal/epl-v10.html"},
                { "name"=>"GNU Lesser General Public License", "url"=>"http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html"}
              ]
            }
          )
        end

        it "returns 'multiple licenses'" do
          subject.license.name.should == 'multiple licenses: Eclipse Public License - v 1.0, GNU Lesser General Public License'
        end
      end

      context "when the license is not found" do
        subject do
          described_class.new(
            {
              "name" => "ch.qos.logback:logback-classic:1.1.1",
              "file" => ["logback-classic-1.1.1.jar"],
              "license" => []
             }
          )
        end

        it "returns 'other' otherwise" do
          subject.license.name.should == "other"
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
license_finder-1.1.1-java spec/lib/license_finder/package_managers/gradle_package_spec.rb
license_finder-1.1.1 spec/lib/license_finder/package_managers/gradle_package_spec.rb
license_finder-1.1.0 spec/lib/license_finder/package_managers/gradle_package_spec.rb
license_finder-1.0.1 spec/lib/license_finder/package_managers/gradle_package_spec.rb