mirror of
https://github.com/github/choosealicense.com
synced 2024-12-22 04:40:09 +01:00
add test that this project's license detected as MIT
This commit is contained in:
parent
8cac9c3d8e
commit
2459e4ff99
@ -1,6 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'licensee'
|
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe 'license meta' do
|
describe 'license meta' do
|
||||||
@ -49,17 +48,6 @@ describe 'license meta' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context 'licensee detects using examples' do
|
context 'licensee detects using examples' do
|
||||||
module Licensee
|
|
||||||
class License
|
|
||||||
class << self
|
|
||||||
def license_dir
|
|
||||||
dir = ::File.dirname(__FILE__)
|
|
||||||
::File.expand_path '../_licenses', dir
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
slug = license['slug']
|
slug = license['slug']
|
||||||
|
|
||||||
examples.each do |example|
|
examples.each do |example|
|
||||||
|
11
spec/self_license_spec.rb
Normal file
11
spec/self_license_spec.rb
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
context 'licensee detects this project' do
|
||||||
|
let(:detected) { Licensee::project('.').license }
|
||||||
|
|
||||||
|
it "license as MIT" do
|
||||||
|
expect(detected.key).to eq('mit')
|
||||||
|
end
|
||||||
|
end
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
require 'jekyll'
|
require 'jekyll'
|
||||||
require 'json'
|
require 'json'
|
||||||
|
require 'licensee'
|
||||||
require 'open-uri'
|
require 'open-uri'
|
||||||
require 'nokogiri'
|
require 'nokogiri'
|
||||||
|
|
||||||
@ -138,3 +139,14 @@ end
|
|||||||
def approved_licenses
|
def approved_licenses
|
||||||
(osi_approved_licenses.keys + fsf_approved_licenses.keys + od_approved_licenses.keys).flatten.uniq.sort
|
(osi_approved_licenses.keys + fsf_approved_licenses.keys + od_approved_licenses.keys).flatten.uniq.sort
|
||||||
end
|
end
|
||||||
|
|
||||||
|
module Licensee
|
||||||
|
class License
|
||||||
|
class << self
|
||||||
|
def license_dir
|
||||||
|
dir = ::File.dirname(__FILE__)
|
||||||
|
::File.expand_path '../_licenses', dir
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user