Sha256: 3e30062182bdd06271c528d5dcf4e587518f3d3e04f3be0bf6f6c7dc500f3e24

Contents?: true

Size: 1.4 KB

Versions: 9

Compression:

Stored size: 1.4 KB

Contents

require 'spec_helper'

module LicenseFinder
  describe CocoaPodsPackage do
    subject do
      described_class.new("Name", "1.0.0", license_text)
    end
    let(:license_text) { nil }

    its(:name) { should == "Name" }
    its(:version) { should == "1.0.0" }
    its(:summary) { should eq "" }
    its(:description) { should eq "" }
    its(:homepage) { should eq "" }
    its(:groups) { should == [] }
    its(:children) { should == [] }

    describe '#licenses' do
      context "when there's a license" do
        let(:license_text) { "LicenseText" }

        it "returns the name of the license if the license is found be text" do
          license = double(:license, name: "LicenseName")
          allow(License).to receive(:find_by_text).with(license_text).and_return(license)

          expect(subject.licenses.map(&:name)).to eq ["LicenseName"]
        end

        it "returns unknown if the license can't be found by text" do
          allow(License).to receive(:find_by_text).with(license_text).and_return(nil)

          expect(subject.licenses.map(&:name)).to eq ["unknown"]
        end
      end

      it "returns unknown when there's no license" do
        expect(subject.licenses.map(&:name)).to eq ["unknown"]
      end

      it "respects license decisions" do
        subject.decide_on_license(License.find_by_name("A"))
        expect(subject.licenses.map(&:name)).to eq ["A"]
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
license_finder-2.1.0.rc4 spec/lib/license_finder/package_managers/cocoa_pods_package_spec.rb
license_finder-2.1.0.rc3 spec/lib/license_finder/package_managers/cocoa_pods_package_spec.rb
license_finder-2.1.0.rc2 spec/lib/license_finder/package_managers/cocoa_pods_package_spec.rb
license_finder-2.1.0.rc1 spec/lib/license_finder/package_managers/cocoa_pods_package_spec.rb
license_finder-2.0.4 spec/lib/license_finder/package_managers/cocoa_pods_package_spec.rb
license_finder-2.0.3 spec/lib/license_finder/package_managers/cocoa_pods_package_spec.rb
license_finder-2.0.2 spec/lib/license_finder/package_managers/cocoa_pods_package_spec.rb
license_finder-2.0.1 spec/lib/license_finder/package_managers/cocoa_pods_package_spec.rb
license_finder-2.0.0 spec/lib/license_finder/package_managers/cocoa_pods_package_spec.rb