Sha256: 3e32f916ef43d3df7a7fee8cfbf289ee77da389dd3bf5620162130c9f85c3d87

Contents?: true

Size: 956 Bytes

Versions: 21

Compression:

Stored size: 956 Bytes

Contents

require 'spec_helper'

describe LicenseFinder::PossibleLicenseFile do
  context "file parsing" do
    subject { LicenseFinder::PossibleLicenseFile.new('root', 'root/nested/path') }

    context "ignoring text" do
      before do
        subject.stub(:text).and_return('file text')
      end

      its(:file_path) { should == 'nested/path' }
      its(:file_name) { should == 'path' }
      its(:text) { should == 'file text' }
    end
  end

  subject { LicenseFinder::PossibleLicenseFile.new('gem', 'gem/license/path') }

  context "with a known license" do
    before do
      subject.stub(:text).and_return('a known license')

      LicenseFinder::License::MIT.stub(:new).with('a known license').and_return(double('MIT license', :matches? => true))
    end

    its(:license) { should == "MIT" }
  end

  context "with an unknown license" do
    before do
      subject.stub(:text).and_return('')
    end

    its(:license) { should be_nil }
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
license_finder-0.9.5 spec/lib/license_finder/possible_license_file_spec.rb
license_finder-0.9.5-java spec/lib/license_finder/possible_license_file_spec.rb
license_finder-0.9.4-java spec/lib/license_finder/possible_license_file_spec.rb
license_finder-0.9.4 spec/lib/license_finder/possible_license_file_spec.rb
license_finder-0.9.3-java spec/lib/license_finder/possible_license_file_spec.rb
license_finder-0.9.3 spec/lib/license_finder/possible_license_file_spec.rb
license_finder-0.9.2-java spec/lib/license_finder/possible_license_file_spec.rb
license_finder-0.9.2 spec/lib/license_finder/possible_license_file_spec.rb
license_finder-0.9.1-java spec/lib/license_finder/possible_license_file_spec.rb
license_finder-0.9.1 spec/lib/license_finder/possible_license_file_spec.rb
license_finder-0.9.0-java spec/lib/license_finder/possible_license_file_spec.rb
license_finder-0.9.0 spec/lib/license_finder/possible_license_file_spec.rb
license_finder-0.8.2-java spec/lib/license_finder/possible_license_file_spec.rb
license_finder-0.8.2 spec/lib/license_finder/possible_license_file_spec.rb
license_finder-0.8.1-java spec/lib/license_finder/possible_license_file_spec.rb
license_finder-0.8.1 spec/lib/license_finder/possible_license_file_spec.rb
license_finder-0.8.0-java spec/lib/license_finder/possible_license_file_spec.rb
license_finder-0.8.0 spec/lib/license_finder/possible_license_file_spec.rb
license_finder-0.7.3 spec/lib/license_finder/possible_license_file_spec.rb
license_finder-0.7.1 spec/lib/license_finder/possible_license_file_spec.rb