diff options
| author | mo khan <mo.khan@gmail.com> | 2020-03-17 13:05:06 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-03-18 10:29:39 -0600 |
| commit | b3a72f1f302ae4b3d10f1fcba847b45a3491845e (patch) | |
| tree | 219e5738406a337de81825ec46fef6474340e606 /spec/integration/java | |
| parent | 2a4bbbd4c655ac2eda4db0f9a89828be799fbca7 (diff) | |
Extract test fixtures
Diffstat (limited to 'spec/integration/java')
| -rw-r--r-- | spec/integration/java/maven_spec.rb | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/spec/integration/java/maven_spec.rb b/spec/integration/java/maven_spec.rb index ad083bb..9b0ee45 100644 --- a/spec/integration/java/maven_spec.rb +++ b/spec/integration/java/maven_spec.rb @@ -5,31 +5,24 @@ RSpec.describe "maven" do describe "When the maven dependencies come from a custom public maven repository" do it 'is able to detect some of the licenses' do - runner.add_file('pom.xml') do - <<~XML -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>com.gitlab.secure</groupId> - <artifactId>license-scanning</artifactId> - <packaging>jar</packaging> - <version>1.0-SNAPSHOT</version> - <name>example</name> - <url>http://maven.apache.org</url> - <dependencies> - <dependency> - <groupId>com.gitlab.xlgmokha</groupId> - <artifactId>mvn-spike</artifactId> - <version>1.2-SNAPSHOT</version> - </dependency> - </dependencies> -</project> - XML - end + runner.add_file('pom.xml', fixture_file_content('pom-public-gitlab-repository.xml')) report = runner.scan(env: { 'CI_PROJECT_ID' => '17523603' }) expect(report).to match_schema(version: '2.0') expect(report[:dependencies]).to match_array([{ name: 'mvn-spike', url: '', description: '', paths: ['.'], licenses: ['MIT'] }]) end + + it 'downloads packages from by using a custom `settings.xml`' do + runner.add_file('pom.xml', fixture_file_content('pom-public-gitlab-repository.xml')) + runner.add_file('my_settings.xml', fixture_file_content(' custom-maven-settings.xml')) + + report = runner.scan(env: { + 'LICENSE_FINDER_CLI_OPTS' => '--maven-options="-S my_settings.xml"' + }) + + expect(report).to match_schema(version: '2.0') + expect(report[:dependencies]).to match_array([{ name: 'mvn-spike', url: '', description: '', paths: ['.'], licenses: ['MIT'] }]) + end end end |
