diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-09-19 18:01:58 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-09-19 18:01:58 +0800 |
commit | a747b9848bc75c7b0394ab523d897d0d53c1c503 (patch) | |
tree | bdef4cd98e20a0c2ab35491be5517358378228b2 | |
parent | 6f848b20a6c5d1afe09af209d6ac88fb344e6722 (diff) | |
download | gitlab-ce-migrate-build_events.tar.gz |
Fix tests for hipchat servicemigrate-build_events
-rw-r--r-- | spec/models/project_services/hipchat_service_spec.rb | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/spec/models/project_services/hipchat_service_spec.rb b/spec/models/project_services/hipchat_service_spec.rb index 3e619b84aff..ec3c033f174 100644 --- a/spec/models/project_services/hipchat_service_spec.rb +++ b/spec/models/project_services/hipchat_service_spec.rb @@ -304,7 +304,7 @@ describe HipchatService, models: true do duration = pipeline.duration expect(message).to eq("<a href=\"#{project_url}\">#{project_name}</a>: " \ - "Commit <a href=\"#{project_url}/pipelines/#{pipelines.id}\">#{Commit.truncate_sha(sha)}</a> " \ + "Pipeline <a href=\"#{project_url}/pipelines/#{pipeline.id}\">#{Commit.truncate_sha(sha)}</a> " \ "of <a href=\"#{project_url}/commits/#{ref}\">#{ref}</a> #{ref_type} " \ "by Unknown failed in #{duration} second(s)") end @@ -312,7 +312,7 @@ describe HipchatService, models: true do context 'for succeeded' do before do - pipeline.success + pipeline.succeed end it "calls Hipchat API" do @@ -348,17 +348,21 @@ describe HipchatService, models: true do context 'with a successful build' do it 'uses the green color' do - build_data = { object_kind: 'build', commit: { status: 'success' } } + data = { object_kind: 'pipeline', + object_attributes: { status: 'success' } } + options = hipchat.__send__(:message_options, data) - expect(hipchat.__send__(:message_options, build_data)).to eq({ notify: false, color: 'green' }) + expect(options).to eq({ notify: false, color: 'green' }) end end context 'with a failed build' do it 'uses the red color' do - build_data = { object_kind: 'build', commit: { status: 'failed' } } + data = { object_kind: 'pipeline', + object_attributes: { status: 'failed' } } + options = hipchat.__send__(:message_options, data) - expect(hipchat.__send__(:message_options, build_data)).to eq({ notify: false, color: 'red' }) + expect(options).to eq({ notify: false, color: 'red' }) end end end |