Sha256: a4fa4f57d358fa445ec26d5df0b5ad60e7c5019e9230f32c1dd7c527b5d99ea2

Contents?: true

Size: 776 Bytes

Versions: 2

Compression:

Stored size: 776 Bytes

Contents

require 'helper'

class TestLicenseeExactMatchers < Minitest::Test
  def setup
    path = Licensee::License.find('mit').path
    text = File.read(path, encoding: 'utf-8').split('---').last
    @mit = Licensee::Project::LicenseFile.new(text)
  end

  should 'match the license' do
    assert_equal 'mit', Licensee::Matchers::Exact.new(@mit).match.key
  end

  should 'know the match confidence' do
    assert_equal 100, Licensee::Matchers::Exact.new(@mit).confidence
  end

  should 'require the file to be the same length' do
    path = Licensee::License.find('mit').path
    text = File.read(path, encoding: 'utf-8').split('---').last
    text << ' MIT'
    license = Licensee::Project::LicenseFile.new(text)
    refute Licensee::Matchers::Exact.new(license).match
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
licensee-8.5.0 test/licensee/matchers/test_exact_matcher.rb
licensee-8.4.0 test/licensee/matchers/test_exact_matcher.rb