diff options
| author | mo khan <mo.khan@gmail.com> | 2020-09-14 16:59:36 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-09-14 16:59:36 -0600 |
| commit | 853ae09d4c6d0220a3f77492065961e65f96e860 (patch) | |
| tree | 6986ed03dfa7545d483c980a31b0ce83582a2811 | |
| parent | 0dc0c0cec97cbdea04e278143e4711cfa0d3bd03 (diff) | |
chore: move classes into lib dir
| -rw-r--r-- | lib/e2e.rb | 3 | ||||
| -rw-r--r-- | lib/e2e/docker.rb (renamed from spec/support/docker.rb) | 21 | ||||
| -rw-r--r-- | lib/e2e/project.rb (renamed from spec/support/project.rb) | 0 | ||||
| -rw-r--r-- | spec/gemnasium_maven_spec.rb | 5 | ||||
| -rw-r--r-- | spec/spec_helper.rb | 5 |
5 files changed, 22 insertions, 12 deletions
diff --git a/lib/e2e.rb b/lib/e2e.rb new file mode 100644 index 0000000..50d7fc4 --- /dev/null +++ b/lib/e2e.rb @@ -0,0 +1,3 @@ +require 'json' +require 'e2e/docker' +require 'e2e/project' diff --git a/spec/support/docker.rb b/lib/e2e/docker.rb index 331ee17..3c4d589 100644 --- a/spec/support/docker.rb +++ b/lib/e2e/docker.rb @@ -1,7 +1,11 @@ # frozen_string_literal: true class Docker - DEFAULT_ENV = { 'CI_PROJECT_DIR' => '/tmp/app' }.freeze + DEFAULT_ENV = { + 'CI_DEBUG_TRACE' => 'true', + 'CI_PROJECT_DIR' => '/tmp/app', + 'SECURE_LOG_LEVEL' => 'debug' + }.freeze attr_reader :pwd def initialize(pwd: Pathname.pwd) @@ -16,14 +20,15 @@ class Docker def run(image:, project_path: Pathname.pwd, env: {}) env_options = DEFAULT_ENV.merge(env).map { |(key, value)| "--env #{key}=#{value}" } + command = expand([:docker, :run, '-it', '--rm', "--volume=#{project_path}:/tmp/app", '--network=host', env_options, image, '/analyzer run']) Dir.chdir pwd do - system([ - :docker, :run, '-it', '--rm', - '--volume', "#{project_path}:/tmp/app", - '--network=host', - env_options, - image, '/analyzer run' - ].flatten.map(&:to_s).join(' ')) + system(command, exception: true) end end + + private + + def expand(command) + command.flatten.map(&:to_s).join(' ') + end end diff --git a/spec/support/project.rb b/lib/e2e/project.rb index a90dfd6..a90dfd6 100644 --- a/spec/support/project.rb +++ b/lib/e2e/project.rb diff --git a/spec/gemnasium_maven_spec.rb b/spec/gemnasium_maven_spec.rb index 5dac7bc..f4e8f32 100644 --- a/spec/gemnasium_maven_spec.rb +++ b/spec/gemnasium_maven_spec.rb @@ -24,6 +24,9 @@ RSpec.describe 'gemnasium-maven' do project.cleanup end - specify { expect(subject.count).to eql(1) } + specify do + puts subject.inspect + expect(subject.count).to eql(1) + end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0280338..c7b393b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -13,9 +13,8 @@ # it. # # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration -require 'json' -require 'support/docker' -require 'support/project' +$LOAD_PATH.unshift(Pathname.pwd.join('lib')) +require 'e2e' require 'support/fixture_file_helper' RSpec.configure do |config| |
