diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-02-28 20:35:22 +0100 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-02-28 20:35:22 +0100 |
commit | e0401df1214397626e65e58166988fe62715d372 (patch) | |
tree | 087d8ca4a1611aa50a8ac98e66f7d1657ff1f90f /spec/models/project_services/chat_message/pipeline_message_spec.rb | |
parent | 2b7b60728426c10ef1188a1073d3630805773a35 (diff) | |
parent | 11c67e7c2f992299ff5918ce67995b73d1e0be6d (diff) | |
download | gitlab-ce-e0401df1214397626e65e58166988fe62715d372.tar.gz |
Merge commit '11c67e7c2f992299ff5918ce67995b73d1e0be6d' into object-storage-ee-to-ce-backport
Diffstat (limited to 'spec/models/project_services/chat_message/pipeline_message_spec.rb')
-rw-r--r-- | spec/models/project_services/chat_message/pipeline_message_spec.rb | 15 |
1 files changed, 8 insertions, 7 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 43b02568cb9..0ff20400999 100644 --- a/spec/models/project_services/chat_message/pipeline_message_spec.rb +++ b/spec/models/project_services/chat_message/pipeline_message_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe ChatMessage::PipelineMessage do subject { described_class.new(args) } - let(:user) { { name: 'hacker' } } + let(:user) { { name: "The Hacker", username: 'hacker' } } let(:duration) { 7210 } let(:args) do { @@ -22,12 +22,13 @@ describe ChatMessage::PipelineMessage do user: user } end + let(:combined_name) { "The Hacker (hacker)" } context 'without markdown' do context 'pipeline succeeded' do let(:status) { 'success' } let(:color) { 'good' } - let(:message) { build_message('passed') } + let(:message) { build_message('passed', combined_name) } it 'returns a message with information about succeeded build' do expect(subject.pretext).to be_empty @@ -39,7 +40,7 @@ describe ChatMessage::PipelineMessage do context 'pipeline failed' do let(:status) { 'failed' } let(:color) { 'danger' } - let(:message) { build_message } + let(:message) { build_message(status, combined_name) } it 'returns a message with information about failed build' do expect(subject.pretext).to be_empty @@ -75,13 +76,13 @@ describe ChatMessage::PipelineMessage do context 'pipeline succeeded' do let(:status) { 'success' } let(:color) { 'good' } - let(:message) { build_markdown_message('passed') } + let(:message) { build_markdown_message('passed', combined_name) } it 'returns a message with information about succeeded build' do expect(subject.pretext).to be_empty expect(subject.attachments).to eq(message) expect(subject.activity).to eq({ - title: 'Pipeline [#123](http://example.gitlab.com/pipelines/123) of branch [develop](http://example.gitlab.com/commits/develop) by hacker passed', + title: 'Pipeline [#123](http://example.gitlab.com/pipelines/123) of branch [develop](http://example.gitlab.com/commits/develop) by The Hacker (hacker) passed', subtitle: 'in [project_name](http://example.gitlab.com)', text: 'in 02:00:10', image: '' @@ -92,13 +93,13 @@ describe ChatMessage::PipelineMessage do context 'pipeline failed' do let(:status) { 'failed' } let(:color) { 'danger' } - let(:message) { build_markdown_message } + let(:message) { build_markdown_message(status, combined_name) } it 'returns a message with information about failed build' do expect(subject.pretext).to be_empty expect(subject.attachments).to eq(message) expect(subject.activity).to eq({ - title: 'Pipeline [#123](http://example.gitlab.com/pipelines/123) of branch [develop](http://example.gitlab.com/commits/develop) by hacker failed', + title: 'Pipeline [#123](http://example.gitlab.com/pipelines/123) of branch [develop](http://example.gitlab.com/commits/develop) by The Hacker (hacker) failed', subtitle: 'in [project_name](http://example.gitlab.com)', text: 'in 02:00:10', image: '' |