Sha256: 98134b9a7d7010de70743ce2b27b24e7674b2bc25b2649b6f11e447bdb754ec5

Contents?: true

Size: 987 Bytes

Versions: 5

Compression:

Stored size: 987 Bytes

Contents

require 'spec_helper'

module LicenseFinder
  describe PossibleLicenseFile do
    context "file parsing" do
      subject { described_class.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 { described_class.new('gem', 'gem/license/path') }

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

        License.stub(:find_by_text).with('a known license').and_return(License.find_by_name("MIT"))
      end

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

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

      its(:license) { should be_nil }
    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/possible_license_file_spec.rb
license_finder-1.1.1 spec/lib/license_finder/possible_license_file_spec.rb
license_finder-1.1.0 spec/lib/license_finder/possible_license_file_spec.rb
license_finder-1.0.1 spec/lib/license_finder/possible_license_file_spec.rb
license_finder-1.0.0.1 spec/lib/license_finder/possible_license_file_spec.rb