diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /qa/spec/support/allure_metadata_formatter_spec.rb | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'qa/spec/support/allure_metadata_formatter_spec.rb')
-rw-r--r-- | qa/spec/support/allure_metadata_formatter_spec.rb | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/qa/spec/support/allure_metadata_formatter_spec.rb b/qa/spec/support/allure_metadata_formatter_spec.rb new file mode 100644 index 00000000000..cb208642716 --- /dev/null +++ b/qa/spec/support/allure_metadata_formatter_spec.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +describe QA::Support::AllureMetadataFormatter do + include Helpers::StubENV + + let(:formatter) { described_class.new(StringIO.new) } + + let(:rspec_example_notification) { double('RSpec::Core::Notifications::ExampleNotification', example: rspec_example) } + let(:rspec_example) do + double( + 'RSpec::Core::Example', + tms: nil, + issue: nil, + add_link: nil, + attempts: 0, + file_path: 'file/path/spec.rb', + metadata: { + testcase: 'testcase', + quarantine: { issue: 'issue' } + } + ) + end + + let(:ci_job) { 'ee:relative 5' } + let(:ci_job_url) { 'url' } + + before do + stub_env('CI', 'true') + stub_env('CI_JOB_NAME', ci_job) + stub_env('CI_JOB_URL', ci_job_url) + end + + it "adds additional data to report" do + formatter.example_started(rspec_example_notification) + + aggregate_failures do + expect(rspec_example).to have_received(:tms).with('Testcase', 'testcase') + expect(rspec_example).to have_received(:issue).with('Quarantine issue', 'issue') + expect(rspec_example).to have_received(:add_link).with(name: "Job(#{ci_job})", url: ci_job_url) + expect(rspec_example).to have_received(:issue).with( + 'Failure issues', + 'https://gitlab.com/gitlab-org/gitlab/-/issues?scope=all&state=opened&search=spec.rb' + ) + end + end +end |