diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-20 18:19:03 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-20 18:19:03 +0300 |
commit | 14bd84b61276ef29b97d23642d698de769bacfd2 (patch) | |
tree | f9eba90140c1bd874211dea17750a0d422c04080 /spec/lib/atlassian/jira_connect/serializers/build_entity_spec.rb | |
parent | 891c388697b2db0d8ee0c8358a9bdbf6dc56d581 (diff) |
Add latest changes from gitlab-org/gitlab@15-10-stable-eev15.10.0-rc42
Diffstat (limited to 'spec/lib/atlassian/jira_connect/serializers/build_entity_spec.rb')
-rw-r--r-- | spec/lib/atlassian/jira_connect/serializers/build_entity_spec.rb | 21 |
1 files changed, 19 insertions, 2 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 |