diff options
| author | mo khan <mo.khan@gmail.com> | 2020-04-14 12:51:18 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-04-14 12:51:18 -0600 |
| commit | 7ca5e094766b70fe8a8783c0c2f33fdeba46d2c5 (patch) | |
| tree | f8c847639a68305b8546f31003faf63d04735984 /spec/integration/java | |
| parent | bae02b6ae73dda47dc86590b73c21a85bb7273a5 (diff) | |
bundle exec rubocop -a
Diffstat (limited to 'spec/integration/java')
| -rw-r--r-- | spec/integration/java/gradle_spec.rb | 28 | ||||
| -rw-r--r-- | spec/integration/java/maven_spec.rb | 54 |
2 files changed, 43 insertions, 39 deletions
diff --git a/spec/integration/java/gradle_spec.rb b/spec/integration/java/gradle_spec.rb index 1b566bb..fcc4347 100644 --- a/spec/integration/java/gradle_spec.rb +++ b/spec/integration/java/gradle_spec.rb @@ -1,20 +1,22 @@ +# frozen_string_literal: true + require 'spec_helper' -RSpec.describe "gradle" do - include_examples "each report version", "java", "gradle" +RSpec.describe 'gradle' do + include_examples 'each report version', 'java', 'gradle' - context "when running a default gradle build" do + context 'when running a default gradle build' do it 'scans a gradle project' do content = <<~GRADLE -/* - * This file was generated by the Gradle 'init' task. - * - * This is a general purpose Gradle build. - * Learn how to create Gradle builds at https://guides.gradle.org/creating-new-gradle-builds - */ -plugins { - id "com.github.hierynomus.license" version "0.15.0" -} + /* + * This file was generated by the Gradle 'init' task. + * + * This is a general purpose Gradle build. + * Learn how to create Gradle builds at https://guides.gradle.org/creating-new-gradle-builds + */ + plugins { + id "com.github.hierynomus.license" version "0.15.0" + } GRADLE runner.add_file('build.gradle', content) @@ -59,7 +61,7 @@ plugins { ].each do |gradle_version| %w[8 11].each do |java_version| context "when scanning a gradle (v#{gradle_version}) project that uses a kotlin build script" do - let(:build_file_content) { fixture_file_content("java/build.gradle.kts") } + let(:build_file_content) { fixture_file_content('java/build.gradle.kts') } it 'scans a gradle project' do runner.add_file('build.gradle.kts', build_file_content) diff --git a/spec/integration/java/maven_spec.rb b/spec/integration/java/maven_spec.rb index 92444e8..1d55026 100644 --- a/spec/integration/java/maven_spec.rb +++ b/spec/integration/java/maven_spec.rb @@ -1,16 +1,18 @@ +# frozen_string_literal: true + require 'spec_helper' -RSpec.describe "maven" do - include_examples "each report version", "java", "maven" - include_examples "each report version", "java", "maven-multimodules" +RSpec.describe 'maven' do + include_examples 'each report version', 'java', 'maven' + include_examples 'each report version', 'java', 'maven-multimodules' - describe "When the maven dependencies come from a custom public maven repository" 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', fixture_file_content('java/pom-public-gitlab-repository.xml')) report = runner.scan(env: { - 'CI_PROJECT_ID' => '17523603' - }) + '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'] }]) @@ -21,34 +23,34 @@ RSpec.describe "maven" do runner.add_file('my_settings.xml', fixture_file_content('java/custom-maven-settings.xml')) report = runner.scan(env: { - 'CI_PROJECT_ID' => 'invalid', - 'MAVEN_CLI_OPTS' => "--settings my_settings.xml" - }) + 'CI_PROJECT_ID' => 'invalid', + 'MAVEN_CLI_OPTS' => '--settings 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 - describe "When using the `SETUP_CMD`" do + describe 'When using the `SETUP_CMD`' do it 'executes the custom script' do runner.add_file('custom.sh') do <<~SCRIPT - #!/bin/bash -l + #!/bin/bash -l - echo 'hello' + echo 'hello' SCRIPT end report = runner.scan(env: { - 'SETUP_CMD' => 'bash custom.sh' - }) + 'SETUP_CMD' => 'bash custom.sh' + }) expect(report).to match_schema(version: '2.0') end end - describe "When scanning a project with multiple modules" do + describe 'When scanning a project with multiple modules' do before do runner.mount(dir: fixture_file('java/maven-multimodule')) end @@ -60,17 +62,17 @@ RSpec.describe "maven" do expect(report[:dependencies]).not_to be_empty [ - { name: "asm", licenses: ["BSD-4-Clause"] }, - { name: "asm-commons", licenses: ["BSD-4-Clause"] }, - { name: "jackson-annotations", licenses: ["Apache-2.0"] }, - { name: "jackson-core", licenses: ["Apache-2.0"] }, - { name: "jackson-databind", licenses: ["Apache-2.0"] }, - { name: "jackson-dataformat-xml", licenses: ["Apache-2.0"] }, - { name: "jackson-module-jaxb-annotations", licenses: ["Apache-2.0"] }, - { name: "log4j-api", licenses: ["Apache-2.0"] }, - { name: "log4j-core", licenses: ["Apache-2.0"] }, - { name: "netty-all", licenses: ["Apache-2.0"] }, - { name: "stax2-api", licenses: ["BSD-4-Clause"] } + { name: 'asm', licenses: ['BSD-4-Clause'] }, + { name: 'asm-commons', licenses: ['BSD-4-Clause'] }, + { name: 'jackson-annotations', licenses: ['Apache-2.0'] }, + { name: 'jackson-core', licenses: ['Apache-2.0'] }, + { name: 'jackson-databind', licenses: ['Apache-2.0'] }, + { name: 'jackson-dataformat-xml', licenses: ['Apache-2.0'] }, + { name: 'jackson-module-jaxb-annotations', licenses: ['Apache-2.0'] }, + { name: 'log4j-api', licenses: ['Apache-2.0'] }, + { name: 'log4j-core', licenses: ['Apache-2.0'] }, + { name: 'netty-all', licenses: ['Apache-2.0'] }, + { name: 'stax2-api', licenses: ['BSD-4-Clause'] } ].each do |dependency| expect(report.licenses_for(dependency[:name])).to match_array(dependency[:licenses]) end |
