diff options
Diffstat (limited to 'spec/lib/atlassian')
-rw-r--r-- | spec/lib/atlassian/jira_connect/serializers/build_entity_spec.rb | 21 | ||||
-rw-r--r-- | spec/lib/atlassian/jira_connect_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/atlassian/jira_issue_key_extractor_spec.rb | 2 |
3 files changed, 21 insertions, 4 deletions
diff --git a/spec/lib/atlassian/jira_connect/serializers/build_entity_spec.rb b/spec/lib/atlassian/jira_connect/serializers/build_entity_spec.rb index 48787f2a0d2..f05adb49651 100644 --- a/spec/lib/atlassian/jira_connect/serializers/build_entity_spec.rb +++ b/spec/lib/atlassian/jira_connect/serializers/build_entity_spec.rb @@ -29,11 +29,11 @@ RSpec.describe Atlassian::JiraConnect::Serializers::BuildEntity, feature_categor end context 'when the pipeline does belong to a Jira issue' do - let(:pipeline) { create(:ci_pipeline, merge_request: merge_request) } + let(:pipeline) { create(:ci_pipeline, merge_request: merge_request, project: project) } %i[jira_branch jira_title jira_description].each do |trait| context "because it belongs to an MR with a #{trait}" do - let(:merge_request) { create(:merge_request, trait) } + let(:merge_request) { create(:merge_request, trait, source_project: project) } describe '#issue_keys' do it 'is not empty' do @@ -48,5 +48,22 @@ RSpec.describe Atlassian::JiraConnect::Serializers::BuildEntity, feature_categor end end end + + context 'in the pipeline\'s commit messsage' do + let_it_be(:pipeline) { create(:ci_pipeline, project: project) } + let(:commit_message) { "Merge branch 'staging' into 'master'\n\nFixes bug described in PROJ-1234" } + + before do + allow(pipeline).to receive(:git_commit_message).and_return(commit_message) + end + + describe '#issue_keys' do + it { expect(subject.issue_keys).to match_array(['PROJ-1234']) } + end + + describe '#to_json' do + it { expect(subject.to_json).to be_valid_json.and match_schema(Atlassian::Schemata.build_info) } + end + end end end diff --git a/spec/lib/atlassian/jira_connect_spec.rb b/spec/lib/atlassian/jira_connect_spec.rb index 14bf13b8fe6..5238fbdb7cd 100644 --- a/spec/lib/atlassian/jira_connect_spec.rb +++ b/spec/lib/atlassian/jira_connect_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'fast_spec_helper' +require 'spec_helper' RSpec.describe Atlassian::JiraConnect, feature_category: :integrations do describe '.app_name' do diff --git a/spec/lib/atlassian/jira_issue_key_extractor_spec.rb b/spec/lib/atlassian/jira_issue_key_extractor_spec.rb index ce29e03f818..42fc441b868 100644 --- a/spec/lib/atlassian/jira_issue_key_extractor_spec.rb +++ b/spec/lib/atlassian/jira_issue_key_extractor_spec.rb @@ -2,7 +2,7 @@ require 'fast_spec_helper' -RSpec.describe Atlassian::JiraIssueKeyExtractor do +RSpec.describe Atlassian::JiraIssueKeyExtractor, feature_category: :integrations do describe '.has_keys?' do subject { described_class.has_keys?(string) } |