diff options
author | Regis <boudinot.regis@yahoo.com> | 2017-03-21 09:08:28 -0600 |
---|---|---|
committer | Regis <boudinot.regis@yahoo.com> | 2017-03-21 09:08:28 -0600 |
commit | 0b75b821c6cfd173291fcfd88c41da9922d082dd (patch) | |
tree | 41b578d299bd77423aa3591955a4cb5ca07ab025 /spec/models/project_services/chat_message/build_message_spec.rb | |
parent | 6342da7bb6cbba1b1e026fc62a1da42b811b25f4 (diff) | |
parent | a08c707c928092426e2334423e71c6b841309ddf (diff) | |
download | gitlab-ce-issue-title-vue.tar.gz |
update to current master and fix conflictsissue-title-vue
Diffstat (limited to 'spec/models/project_services/chat_message/build_message_spec.rb')
-rw-r--r-- | spec/models/project_services/chat_message/build_message_spec.rb | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/spec/models/project_services/chat_message/build_message_spec.rb b/spec/models/project_services/chat_message/build_message_spec.rb deleted file mode 100644 index 3bd7ec18ae0..00000000000 --- a/spec/models/project_services/chat_message/build_message_spec.rb +++ /dev/null @@ -1,77 +0,0 @@ -require 'spec_helper' - -describe ChatMessage::BuildMessage do - subject { described_class.new(args) } - - let(:args) do - { - sha: '97de212e80737a608d939f648d959671fb0a0142', - ref: 'develop', - tag: false, - - project_name: 'project_name', - project_url: 'http://example.gitlab.com', - build_id: 1, - build_name: build_name, - build_stage: stage, - - commit: { - status: status, - author_name: 'hacker', - author_url: 'http://example.gitlab.com/hacker', - duration: duration, - }, - } - end - - let(:message) { build_message } - let(:stage) { 'test' } - let(:status) { 'success' } - let(:build_name) { 'rspec' } - let(:duration) { 10 } - - context 'build succeeded' do - let(:status) { 'success' } - let(:color) { 'good' } - let(:message) { build_message('passed') } - - it 'returns a message with information about succeeded build' do - expect(subject.pretext).to be_empty - expect(subject.fallback).to eq(message) - expect(subject.attachments).to eq([text: message, color: color]) - end - end - - context 'build failed' do - let(:status) { 'failed' } - let(:color) { 'danger' } - - it 'returns a message with information about failed build' do - expect(subject.pretext).to be_empty - expect(subject.fallback).to eq(message) - expect(subject.attachments).to eq([text: message, color: color]) - end - end - - it 'returns a message with information on build' do - expect(subject.fallback).to include("on build <http://example.gitlab.com/builds/1|#{build_name}>") - end - - it 'returns a message with stage name' do - expect(subject.fallback).to include("of stage #{stage}") - end - - it 'returns a message with link to author' do - expect(subject.fallback).to include("by <http://example.gitlab.com/hacker|hacker>") - end - - def build_message(status_text = status, stage_text = stage, build_text = build_name) - "<http://example.gitlab.com|project_name>:" \ - " Commit <http://example.gitlab.com/commit/" \ - "97de212e80737a608d939f648d959671fb0a0142/builds|97de212e>" \ - " of <http://example.gitlab.com/commits/develop|develop> branch" \ - " by <http://example.gitlab.com/hacker|hacker> #{status_text}" \ - " on build <http://example.gitlab.com/builds/1|#{build_text}>" \ - " of stage #{stage_text} in #{duration} #{'second'.pluralize(duration)}" - end -end |