summaryrefslogtreecommitdiff
path: root/spec/integration
diff options
context:
space:
mode:
authorTetiana Chupryna <tchupryna@gitlab.com>2020-02-17 10:58:47 +0000
committerTetiana Chupryna <tchupryna@gitlab.com>2020-02-17 10:58:47 +0000
commita307d82c1f855b1d1b113289216911c168523a2f (patch)
tree712c39bf7972f70669d1be33e6b653356adebcae /spec/integration
parentc6f2ad7ea95cae4d4f4f8e192eeab8b466dfd166 (diff)
parent94b7c0a650af89f366e5317ff6a28355528ec30b (diff)
Merge branch '198043-gradle-scanning' into 'master'v2.4.3
Scan projects with bundled gradle wrapper See merge request gitlab-org/security-products/license-management!109
Diffstat (limited to 'spec/integration')
-rw-r--r--spec/integration/java/gradle_spec.rb27
1 files changed, 26 insertions, 1 deletions
diff --git a/spec/integration/java/gradle_spec.rb b/spec/integration/java/gradle_spec.rb
index 55bde8d..fc52c72 100644
--- a/spec/integration/java/gradle_spec.rb
+++ b/spec/integration/java/gradle_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
RSpec.describe "gradle" do
context "when running a default gradle build" do
- it 'installs the required ruby and produces a valid report' do
+ it 'scans a gradle project' do
content = <<~GRADLE
/*
* This file was generated by the Gradle 'init' task.
@@ -22,4 +22,29 @@ plugins {
expect(report[:dependencies]).to be_empty
end
end
+
+ context 'when scanning a gradle project that does not include the `com.github.hierynomus.license` plugin' do
+ let(:project_url) { 'https://gitlab.com/one-touch-pipeline/otp.git' }
+ let(:result) { runner.scan }
+
+ before do
+ runner.clone(project_url)
+ end
+
+ it 'is able to detect licenses' do
+ expect(result).not_to be_empty
+ expect(result).to match_schema(version: '2.0')
+ expect(result[:licenses]).not_to be_empty
+
+ [
+ { name: 'ant', licenses: ['Apache-2.0'] },
+ { name: 'activation', licenses: ['CDDL-1.0'] },
+ { name: 'xml-apis', licenses: ['Apache-2.0', 'SAX-PD', 'W3C-20150513'] },
+ { name: 'sitemesh', licenses: ['Apache-1.1'] },
+ { name: 'hibernate-jpa-2.1-api', licenses: ['BSD-3-Clause', 'EPL-1.0'] },
+ ].each do |dependency|
+ expect(find_in(result, dependency[:name])[:licenses]).to match_array(dependency[:licenses])
+ end
+ end
+ end
end