From 2393d30da232db04faa8da9e1a958cec22ffb6e8 Mon Sep 17 00:00:00 2001 From: "Z.J. van de Weg" Date: Tue, 20 Dec 2016 20:11:02 +0100 Subject: Fix rubocop errors [ci skip] --- app/models/project_services/mattermost_slash_commands_service.rb | 6 +++--- lib/mattermost/client.rb | 2 +- spec/features/projects/services/mattermost_slash_command_spec.rb | 1 - .../project_services/mattermost_slash_commands_service_spec.rb | 6 +++--- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/models/project_services/mattermost_slash_commands_service.rb b/app/models/project_services/mattermost_slash_commands_service.rb index 4c2b7d64f1f..fc1e7d79d08 100644 --- a/app/models/project_services/mattermost_slash_commands_service.rb +++ b/app/models/project_services/mattermost_slash_commands_service.rb @@ -24,13 +24,13 @@ class MattermostSlashCommandsService < ChatSlashCommandsService create(command(params)) update(active: true, token: token) if token - rescue => Mattermost::Error => e - false, e.message + rescue Mattermost::Error => e + [false, e.message] end def list_teams(user) Mattermost::Team.new(user).all - rescue => Mattermost::Error => e + rescue Mattermost::Error [] end diff --git a/lib/mattermost/client.rb b/lib/mattermost/client.rb index 6eaaed34063..fa3c9fa27bd 100644 --- a/lib/mattermost/client.rb +++ b/lib/mattermost/client.rb @@ -34,7 +34,7 @@ module Mattermost end json_response - rescue JSON::JSONError => e + rescue JSON::JSONError raise ClientError('Cannot parse response') end end diff --git a/spec/features/projects/services/mattermost_slash_command_spec.rb b/spec/features/projects/services/mattermost_slash_command_spec.rb index 521eedeae9e..73ecf86aded 100644 --- a/spec/features/projects/services/mattermost_slash_command_spec.rb +++ b/spec/features/projects/services/mattermost_slash_command_spec.rb @@ -41,7 +41,6 @@ feature 'Setup Mattermost slash commands', feature: true do end end - describe 'mattermost service is not enabled' do before do allow(Gitlab.config.mattermost).to receive(:enabled).and_return(false) 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 9fb6132d171..07662d2d89a 100644 --- a/spec/models/project_services/mattermost_slash_commands_service_spec.rb +++ b/spec/models/project_services/mattermost_slash_commands_service_spec.rb @@ -10,13 +10,13 @@ describe MattermostSlashCommandsService, :models do before do allow_any_instance_of(Mattermost::Session).to - receive(:with_session).and_yield + receive(:with_session).and_yield end subject do service.configure!(user, team_id: 'abc', - trigger: 'gitlab', url: 'http://trigger.url', - icon_url: 'http://icon.url/icon.png') + trigger: 'gitlab', url: 'http://trigger.url', + icon_url: 'http://icon.url/icon.png') end context 'the requests succeeds' do -- cgit v1.2.1