1
0
mirror of https://github.com/github/choosealicense.com synced 2024-12-22 12:50:24 +01:00

@benbalter review suggestions

This commit is contained in:
Mike Linksvayer 2017-11-27 12:56:25 -08:00
parent 2c9fa4907e
commit 8630a017f8

View File

@ -60,20 +60,27 @@ describe 'license meta' do
end end
end end
slug = license['slug']
examples.each do |example| examples.each do |example|
example_url = example.values[0] example_url = example.values[0]
if example_url.index('https://github.com/') == 0
example_url.gsub!(%r{\Ahttps://github.com/([\w-]+/[\w-]+)/blob/([\w-]+/\S+)\z}, 'https://raw.githubusercontent.com/\1/\2') context "the #{example_url} URL" do
elsif example_url.index('https://git.savannah.gnu.org/') == 0 || example_url.index('https://git.gnome.org/') == 0 let(:content) { open(example_url).read }
example_url.gsub!(%r{/tree/}, '/plain/') let(:detected) { Licensee::ProjectFiles::LicenseFile.new(content, 'LICENSE').license }
elsif example_url.index('https://bitbucket.org/') == 0
example_url.gsub!(%r{/src/}, '/raw/') if example_url.start_with?('https://github.com/')
end example_url.gsub!(%r{\Ahttps://github.com/([\w-]+/[\w-]+)/blob/([\w-]+/\S+)\z}, 'https://raw.githubusercontent.com/\1/\2')
content = open(example_url).read elsif example_url.start_with?('https://git.savannah.gnu.org/', 'https://git.gnome.org/')
detected = Licensee::ProjectFiles::LicenseFile.new(content, 'LICENSE').license example_url.gsub!(%r{/tree/}, '/plain/')
it example_url do elsif example_url.start_with?('https://bitbucket.org/')
skip 'NCSA and PostgreSQL licenses hard to detect' if %(ncsa postgresql).include?(license['slug']) example_url.gsub!(%r{/src/}, '/raw/')
expect(detected.key).to eq(license['slug']) end
it "is a #{slug} license" do
skip 'NCSA and PostgreSQL licenses hard to detect' if %(ncsa postgresql).include?(slug)
expect(detected.key).to eq(slug)
end
end end
end end
end end