Sha256: 6924262578b960d693c53984ff40bfaf3329f6da573a7031eb6aa0e276702dd2

Contents?: true

Size: 832 Bytes

Versions: 8

Compression:

Stored size: 832 Bytes

Contents

require 'helper'

class TestLicenseeLicenseFile < Minitest::Test

  def setup
    @repo = Rugged::Repository.new(fixture_path("licenses.git"))
    blob = 'bcb552d06d9cf1cd4c048a6d3bf716849c2216cc'
    @file = Licensee::LicenseFile.new(@repo.lookup(blob), :path => "LICENSE")
    @gpl = Licensee::Licenses.find "GPL-3.0"
    @mit = Licensee::Licenses.find "MIT"
  end

  should "read the file" do
    assert @file.contents =~ /MIT/
  end

  should "match the license" do
    assert_equal "mit", @file.match.key
  end

  should "know the path" do
    assert_equal "LICENSE", @file.path
  end

  should "diff the file" do
    expected = "-Copyright (c) [year] [fullname]\n+Copyright (c) 2014 Ben Balter"
    assert @file.diff.include?(expected)
  end

  should "calculate confidence" do
    assert_equal 94, @file.confidence
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
licensee-4.9.0 test/test_licensee_license_file.rb
licensee-4.8.0 test/test_licensee_license_file.rb
licensee-4.7.4 test/test_licensee_license_file.rb
licensee-4.7.3 test/test_licensee_license_file.rb
licensee-4.7.2 test/test_licensee_license_file.rb
licensee-4.7.1 test/test_licensee_license_file.rb
licensee-4.7.0 test/test_licensee_license_file.rb
licensee-4.6.0 test/test_licensee_license_file.rb