diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-22 15:06:20 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-22 15:06:20 +0300 |
commit | b1bcdba89bc241e2cede910f26cf3f5fff8d7901 (patch) | |
tree | 41b45ec9ff1ba56c93b29b00435495e7e5abf02b /spec/models/project_services/chat_message | |
parent | 30dc5b50569db30fef06cc7ab66e7341161b3c70 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/project_services/chat_message')
-rw-r--r-- | spec/models/project_services/chat_message/pipeline_message_spec.rb | 39 | ||||
-rw-r--r-- | spec/models/project_services/chat_message/push_message_spec.rb | 6 |
2 files changed, 42 insertions, 3 deletions
diff --git a/spec/models/project_services/chat_message/pipeline_message_spec.rb b/spec/models/project_services/chat_message/pipeline_message_spec.rb index cf7c7bf7e61..366ef01924e 100644 --- a/spec/models/project_services/chat_message/pipeline_message_spec.rb +++ b/spec/models/project_services/chat_message/pipeline_message_spec.rb @@ -159,6 +159,45 @@ describe ChatMessage::PipelineMessage do ) end end + + context 'when ref type is tag' do + before do + args[:object_attributes][:tag] = true + args[:object_attributes][:ref] = 'new_tag' + end + + it "returns the pipeline summary in the activity's title" do + expect(subject.activity[:title]).to eq( + "Pipeline [#123](http://example.gitlab.com/pipelines/123)" \ + " of tag [new_tag](http://example.gitlab.com/-/tags/new_tag)" \ + " by The Hacker (hacker) passed" + ) + end + + it "returns the pipeline summary as the attachment's text property" do + expect(subject.attachments.first[:text]).to eq( + "<http://example.gitlab.com|project_name>:" \ + " Pipeline <http://example.gitlab.com/pipelines/123|#123>" \ + " of tag <http://example.gitlab.com/-/tags/new_tag|new_tag>" \ + " by The Hacker (hacker) passed in 02:00:10" + ) + end + + context 'when rendering markdown' do + before do + args[:markdown] = true + end + + it 'returns the pipeline summary as the attachments in markdown format' do + expect(subject.attachments).to eq( + "[project_name](http://example.gitlab.com):" \ + " Pipeline [#123](http://example.gitlab.com/pipelines/123)" \ + " of tag [new_tag](http://example.gitlab.com/-/tags/new_tag)" \ + " by The Hacker (hacker) passed in 02:00:10" + ) + end + end + end end context 'when the fancy_pipeline_slack_notifications feature flag is enabled' do diff --git a/spec/models/project_services/chat_message/push_message_spec.rb b/spec/models/project_services/chat_message/push_message_spec.rb index 2bde0b93fda..fe0b2fe3440 100644 --- a/spec/models/project_services/chat_message/push_message_spec.rb +++ b/spec/models/project_services/chat_message/push_message_spec.rb @@ -96,7 +96,7 @@ describe ChatMessage::PushMessage do context 'without markdown' do it 'returns a message regarding pushes' do expect(subject.pretext).to eq('test.user pushed new tag ' \ - '<http://url.com/commits/new_tag|new_tag> to ' \ + '<http://url.com/-/tags/new_tag|new_tag> to ' \ '<http://url.com|project_name>') expect(subject.attachments).to be_empty end @@ -109,10 +109,10 @@ describe ChatMessage::PushMessage do it 'returns a message regarding pushes' do expect(subject.pretext).to eq( - 'test.user pushed new tag [new_tag](http://url.com/commits/new_tag) to [project_name](http://url.com)') + 'test.user pushed new tag [new_tag](http://url.com/-/tags/new_tag) to [project_name](http://url.com)') expect(subject.attachments).to be_empty expect(subject.activity).to eq( - title: 'test.user pushed new tag [new_tag](http://url.com/commits/new_tag)', + title: 'test.user pushed new tag [new_tag](http://url.com/-/tags/new_tag)', subtitle: 'in [project_name](http://url.com)', text: '[Compare changes](http://url.com/compare/0000000000000000000000000000000000000000...after)', image: 'http://someavatar.com' |