summaryrefslogtreecommitdiff
path: root/spec/gemnasium_maven_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/gemnasium_maven_spec.rb')
-rw-r--r--spec/gemnasium_maven_spec.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/spec/gemnasium_maven_spec.rb b/spec/gemnasium_maven_spec.rb
index b20d9d9..60d7a87 100644
--- a/spec/gemnasium_maven_spec.rb
+++ b/spec/gemnasium_maven_spec.rb
@@ -1,3 +1,5 @@
+require 'openssl'
+
RSpec.describe 'gemnasium-maven' do
context "when scanning a java project with packages from a custom source" do
subject do
@@ -10,8 +12,20 @@ RSpec.describe 'gemnasium-maven' do
let(:docker) { Docker.new(pwd: Pathname.pwd.join('src/gemnasium-maven')) }
let(:project_path) { project.path }
let(:docker_image) { 'gemnasium-maven:latest' }
- let(:env) { { } }
+ let(:env) { { 'ADDITIONAL_CA_CERT_BUNDLE' => x509 } }
let(:project) { Project.new }
+ let(:x509) do
+ rsa_key = OpenSSL::PKey::RSA.new(4096)
+ certificate = OpenSSL::X509::Certificate.new
+ certificate.subject = certificate.issuer = OpenSSL::X509::Name.parse("/C=/ST=/L=/O=/OU=/CN=")
+ certificate.not_before = Time.now.to_i
+ certificate.not_after = Time.now.to_i + 600
+ certificate.public_key = rsa_key.public_key
+ certificate.serial = 0x01
+ certificate.version = 2
+ certificate.sign(rsa_key, OpenSSL::Digest::SHA256.new)
+ certificate.to_pem
+ end
around(:example) do |example|
project.mount(dir: fixture_file('java/maven/custom-tls'))