Sha256: 23f592a89c939f2ff49c34a8641202d78671a344f3ba4f617ddaa258ab826880

Contents?: true

Size: 1.88 KB

Versions: 2

Compression:

Stored size: 1.88 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 == "" }
    its(:licenses_from_spec) { should == ["Eclipse Public License - v 1.0"] }

    describe "#license" do
      it "returns the license if found" do
        subject.license.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 'other'" do
          subject.license.should == 'other'
        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.should == "other"
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
license_finder-1.0.0.0 spec/lib/license_finder/package_managers/gradle_package_spec.rb
license_finder-1.0.0.0-java spec/lib/license_finder/package_managers/gradle_package_spec.rb