Sha256: 02cd7ad93985d5c30785d8ca6677632c632a2fad331cbe2b18560f754d144f64

Contents?: true

Size: 1.27 KB

Versions: 5

Compression:

Stored size: 1.27 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 }

    it_behaves_like "it conforms to interface required by PackageSaver"

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

    describe '#license' 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.license.name).to eq "LicenseName"
        end

        it "returns other 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.license.name).to eq "other"
        end
      end

      it "returns other when there's no license" do
        expect(subject.license.name).to eq "other"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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