diff options
| author | mo khan <mo.khan@gmail.com> | 2020-09-16 12:33:36 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-09-16 12:33:36 -0600 |
| commit | bbd64b04d484792307ed58f847d86df5bcbe7440 (patch) | |
| tree | dfd09334255473977b583daa2c4cf357fa26a941 /spec/support/scanner_context.rb | |
| parent | 47b673882a84d7683a07b4e366132a80a3ff1313 (diff) | |
refactor: refactor gemnasium-maven tests to use shared context
Diffstat (limited to 'spec/support/scanner_context.rb')
| -rw-r--r-- | spec/support/scanner_context.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/support/scanner_context.rb b/spec/support/scanner_context.rb new file mode 100644 index 0000000..6a17835 --- /dev/null +++ b/spec/support/scanner_context.rb @@ -0,0 +1,21 @@ +RSpec.shared_context 'a scanner' do + subject { project.report_for(type: report_type) } + + let(:docker) { Docker.new(pwd: Pathname.pwd.join("src/#{scanner}")) } + let(:docker_image) { "#{scanner}:latest" } + let(:scanner) { self.class.description } + let(:project) { Project.new } + let(:report_type) { raise 'report_type not specified' } + let(:env) { { } } + + around :example do |example| + project.mount(dir: fixture_file(project_fixture)) + docker.run(image: docker_image, project_path: project.path, env: env) + example.run + project.cleanup + end +end + +RSpec.configure do |config| + config.include_context 'a scanner' +end |
