From 2459e4ff99b522850c106f74e1f990f8aaa4b057 Mon Sep 17 00:00:00 2001 From: Mike Linksvayer Date: Sat, 30 Dec 2017 15:38:31 -0800 Subject: [PATCH] add test that this project's license detected as MIT --- spec/license_meta_spec.rb | 12 ------------ spec/self_license_spec.rb | 11 +++++++++++ spec/spec_helper.rb | 12 ++++++++++++ 3 files changed, 23 insertions(+), 12 deletions(-) create mode 100644 spec/self_license_spec.rb diff --git a/spec/license_meta_spec.rb b/spec/license_meta_spec.rb index 37a123e..df2957c 100644 --- a/spec/license_meta_spec.rb +++ b/spec/license_meta_spec.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true -require 'licensee' require 'spec_helper' describe 'license meta' do @@ -49,17 +48,6 @@ describe 'license meta' do end 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'] examples.each do |example| diff --git a/spec/self_license_spec.rb b/spec/self_license_spec.rb new file mode 100644 index 0000000..178c9be --- /dev/null +++ b/spec/self_license_spec.rb @@ -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 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9912e62..e66a9a1 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,6 +2,7 @@ require 'jekyll' require 'json' +require 'licensee' require 'open-uri' require 'nokogiri' @@ -138,3 +139,14 @@ end def approved_licenses (osi_approved_licenses.keys + fsf_approved_licenses.keys + od_approved_licenses.keys).flatten.uniq.sort end + +module Licensee + class License + class << self + def license_dir + dir = ::File.dirname(__FILE__) + ::File.expand_path '../_licenses', dir + end + end + end +end