summaryrefslogtreecommitdiff
path: root/spec/integration
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-01-28 15:02:15 -0700
committermo khan <mo.khan@gmail.com>2020-02-13 15:34:58 -0700
commitf8d0804b0435e0ccacb905ef34b5c2b7da4eb449 (patch)
tree64779a8453c8ae9527cc5f3ce7e40a4a471c29d9 /spec/integration
parentd45f5fc5e075cfc27e9156e0449cba12e901ec69 (diff)
Add integration test to scan a gradle project
* Skip gradle invocation and install plugin globally * Update init.gradle * Try project.apply plugin: syntax * apply gradle plugin * Add entry to normalized licenses * Update spdx-licenses * Add CHANGELOG entry
Diffstat (limited to 'spec/integration')
-rw-r--r--spec/integration/java/gradle_spec.rb28
1 files changed, 27 insertions, 1 deletions
diff --git a/spec/integration/java/gradle_spec.rb b/spec/integration/java/gradle_spec.rb
index 55bde8d..6516cf6 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,30 @@ plugins {
expect(report[:dependencies]).to be_empty
end
end
+
+ def find_in(report, name)
+ report[:dependencies].find do |dependency|
+ dependency[:name] == name
+ end
+ end
+
+ it 'scans https://gitlab.com/one-touch-pipeline/otp.git' do
+ runner.clone('https://gitlab.com/one-touch-pipeline/otp.git')
+ report = runner.scan
+
+ expect(report).not_to be_empty
+ expect(report).to match_schema(version: '2.0')
+ expect(report[:licenses].count).not_to be_zero
+ expect(report[:dependencies].count).not_to be_zero
+
+ [
+ { 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 |item|
+ expect(find_in(report, item[:name])[:licenses]).to match_array(item[:licenses])
+ end
+ end
end