mirror of
https://github.com/github/choosealicense.com
synced 2024-11-12 14:38:53 +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
|
||||
licenses.each do |license|
|
||||
context "The #{license['title']} license" do
|
||||
matches = license['content'].scan(/(\A|\W)\[([a-z]+)\]/).map {|row| row[1]}
|
||||
extra_fields = matches.flatten - (fields.map { |f| f['name'] })
|
||||
it 'should only contain supported fillable fields' do
|
||||
matches = license['content'].scan(/\s+\[([a-z]+)\]\s+/)
|
||||
extra_fields = matches.flatten - (fields.map { |f| f['name'] })
|
||||
expect(extra_fields).to be_empty
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user