mirror of
https://github.com/github/choosealicense.com
synced 2025-01-05 11:32:01 +01:00
loosen fields matching regex, check no supported fields missed
This commit is contained in:
parent
c02073ebdb
commit
286357a54c
@ -5,11 +5,16 @@ require 'spec_helper'
|
|||||||
describe 'license fillable fields' do
|
describe 'license fillable fields' do
|
||||||
licenses.each do |license|
|
licenses.each do |license|
|
||||||
context "The #{license['title']} license" do
|
context "The #{license['title']} license" do
|
||||||
it 'should only contain supported fillable fields' do
|
matches = license['content'].scan(/(\A|\W)\[([a-z]+)\]/).map {|row| row[1]}
|
||||||
matches = license['content'].scan(/\s+\[([a-z]+)\]\s+/)
|
|
||||||
extra_fields = matches.flatten - (fields.map { |f| f['name'] })
|
extra_fields = matches.flatten - (fields.map { |f| f['name'] })
|
||||||
|
it 'should only contain supported fillable fields' do
|
||||||
expect(extra_fields).to be_empty
|
expect(extra_fields).to be_empty
|
||||||
end
|
end
|
||||||
|
it 'does not overlook supported fillable fields' do
|
||||||
|
matches_generous = license['content'].scan(/\[([a-z]+)\]/)
|
||||||
|
extra_fields_generous = matches_generous.flatten - (fields.map { |f| f['name'] })
|
||||||
|
expect(matches_generous.flatten - extra_fields_generous).to eq matches
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user