Sha256: 2b6b9b1aeb94d4dc350dd0f4374b7e124c9320394cce130c1111f803d6d50178

Contents?: true

Size: 971 Bytes

Versions: 2

Compression:

Stored size: 971 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(:text) { should == 'file text' } # this is a terrible test, considering the stubbing
    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.stub(:find_by_text).with('a known license').and_return(LicenseFinder::License.find_by_name("MIT"))
    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

2 entries across 2 versions & 1 rubygems

Version Path
license_finder-1.0.0.0 spec/lib/license_finder/possible_license_file_spec.rb
license_finder-1.0.0.0-java spec/lib/license_finder/possible_license_file_spec.rb