diff options
author | Z.J. van de Weg <git@zjvandeweg.nl> | 2016-12-20 20:56:46 +0100 |
---|---|---|
committer | Z.J. van de Weg <git@zjvandeweg.nl> | 2016-12-20 20:57:09 +0100 |
commit | 4a03fae930a58b485ee610ce9e6058a2c2dd3d6e (patch) | |
tree | 418163b6578935b3660de4da67ab0e946f80acf6 /spec/models/project_services | |
parent | 0bd8669f3a606479e3f97683e0bfb178856df422 (diff) | |
download | gitlab-ce-4a03fae930a58b485ee610ce9e6058a2c2dd3d6e.tar.gz |
Fix rspec tests due to different API
[ci skip]
Diffstat (limited to 'spec/models/project_services')
-rw-r--r-- | spec/models/project_services/mattermost_slash_commands_service_spec.rb | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/spec/models/project_services/mattermost_slash_commands_service_spec.rb b/spec/models/project_services/mattermost_slash_commands_service_spec.rb index 07662d2d89a..850ca45ddd8 100644 --- a/spec/models/project_services/mattermost_slash_commands_service_spec.rb +++ b/spec/models/project_services/mattermost_slash_commands_service_spec.rb @@ -3,23 +3,23 @@ require 'spec_helper' describe MattermostSlashCommandsService, :models do it_behaves_like "chat slash commands service" - describe '#configure!' do + describe '#configure' do let(:project) { create(:empty_project) } let(:service) { project.build_mattermost_slash_commands_service } let(:user) { create(:user)} - before do - allow_any_instance_of(Mattermost::Session).to - receive(:with_session).and_yield - end - subject do - service.configure!(user, team_id: 'abc', + service.configure(user, team_id: 'abc', trigger: 'gitlab', url: 'http://trigger.url', icon_url: 'http://icon.url/icon.png') end context 'the requests succeeds' do + before do + allow_any_instance_of(Mattermost::Command). + to receive(:json_post).and_return('token' => 'token') + end + it 'saves the service' do expect { subject }.to change { project.services.count }.by(1) end @@ -27,13 +27,16 @@ describe MattermostSlashCommandsService, :models do it 'saves the token' do subject - expect(service.reload.token).to eq('mynewtoken') + expect(service.reload.token).to eq('token') end end context 'an error is received' do it 'shows error messages' do - expect(subject).to raise_error("Error") + succeeded, message = subject + + expect(succeeded).to be(false) + expect(message).to start_with("Failed to open TCP connection to") end end end |