summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/gemnasium_maven_spec.rb21
-rw-r--r--spec/spec_helper.rb2
2 files changed, 23 insertions, 0 deletions
diff --git a/spec/gemnasium_maven_spec.rb b/spec/gemnasium_maven_spec.rb
new file mode 100644
index 0000000..63c9aae
--- /dev/null
+++ b/spec/gemnasium_maven_spec.rb
@@ -0,0 +1,21 @@
+RSpec.describe 'gemnasium-maven' do
+ context "when scanning a java project with packages from a custom source" do
+ subject do
+ Dir.chdir Pathname.pwd.join('src/gemnasium-maven') do
+ system("docker build --network=host -t #{docker_image} .")
+
+ if system([ :docker, :run, '-it', '--rm', '--volume', "#{project_path}:/tmp/app", '--network=host', '--env', 'CI_PROJECT_DIR=/tmp/app', docker_image, '/analyzer run' ].map(&:to_s).join(' '))
+ report_path = project_path.join('gl-license-scanning-report.json')
+ report_path.exist? ? JSON.parse(report_path.read) : {}
+ else
+ {}
+ end
+ end
+ end
+
+ let(:project_path) { Dir.pwd }
+ let(:docker_image) { 'gemnasium-maven:latest' }
+
+ specify { expect(subject.count).to eql(1) }
+ end
+end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 251aa51..8cfc067 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -13,6 +13,8 @@
# it.
#
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
+require 'json'
+
RSpec.configure do |config|
# rspec-expectations config goes here. You can use an alternate
# assertion/expectation library such as wrong or the stdlib/minitest