Sha256: 9e3c75a17789e8b75feb8e7d647228c13acdab910c369ebceb0512636853c9cc

Contents?: true

Size: 1 KB

Versions: 22

Compression:

Stored size: 1 KB

Contents

require 'spec_helper'

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

      context "ignoring text" do
        before do
          allow(subject).to receive(:text).and_return('file text')
        end

        its(:text) { should == 'file text' } # this is a terrible test, considering the stubbing
        its(:path) { should == 'root/nested/path' }
      end
    end

    subject { described_class.new('gem/license/path') }

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

        allow(License).to receive(: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
        allow(subject).to receive(:text).and_return('')
      end

      its(:license) { should be_nil }
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
license_finder-3.0.4 spec/lib/license_finder/packages/possible_license_file_spec.rb
license_finder-3.0.2 spec/lib/license_finder/packages/possible_license_file_spec.rb
license_finder-3.0.1 spec/lib/license_finder/packages/possible_license_file_spec.rb
license_finder-3.0.0 spec/lib/license_finder/packages/possible_license_file_spec.rb
license_finder-2.1.2 spec/lib/license_finder/packages/possible_license_file_spec.rb
license_finder-2.1.1 spec/lib/license_finder/packages/possible_license_file_spec.rb
license_finder-2.1.0 spec/lib/license_finder/packages/possible_license_file_spec.rb
license_finder-2.1.0.rc9 spec/lib/license_finder/packages/possible_license_file_spec.rb
license_finder-2.1.0.rc8 spec/lib/license_finder/packages/possible_license_file_spec.rb
license_finder-2.1.0.rc7 spec/lib/license_finder/packages/possible_license_file_spec.rb
license_finder-2.1.0.rc6 spec/lib/license_finder/packages/possible_license_file_spec.rb
license_finder-2.1.0.rc5 spec/lib/license_finder/packages/possible_license_file_spec.rb
license_finder-2.1.0.rc4 spec/lib/license_finder/packages/possible_license_file_spec.rb
license_finder-2.1.0.rc3 spec/lib/license_finder/packages/possible_license_file_spec.rb
license_finder-2.1.0.rc2 spec/lib/license_finder/packages/possible_license_file_spec.rb
license_finder-2.1.0.rc1 spec/lib/license_finder/packages/possible_license_file_spec.rb
license_finder-2.0.4 spec/lib/license_finder/packages/possible_license_file_spec.rb
license_finder-2.0.3 spec/lib/license_finder/packages/possible_license_file_spec.rb
license_finder-2.0.2 spec/lib/license_finder/packages/possible_license_file_spec.rb
license_finder-2.0.1 spec/lib/license_finder/packages/possible_license_file_spec.rb