Fix rubocop errors [ci skip]

This commit is contained in:
Z.J. van de Weg 2016-12-20 20:11:02 +01:00
parent e9c14918e5
commit 2393d30da2
4 changed files with 7 additions and 8 deletions

View File

@ -24,13 +24,13 @@ class MattermostSlashCommandsService < ChatSlashCommandsService
create(command(params)) create(command(params))
update(active: true, token: token) if token update(active: true, token: token) if token
rescue => Mattermost::Error => e rescue Mattermost::Error => e
false, e.message [false, e.message]
end end
def list_teams(user) def list_teams(user)
Mattermost::Team.new(user).all Mattermost::Team.new(user).all
rescue => Mattermost::Error => e rescue Mattermost::Error
[] []
end end

View File

@ -34,7 +34,7 @@ module Mattermost
end end
json_response json_response
rescue JSON::JSONError => e rescue JSON::JSONError
raise ClientError('Cannot parse response') raise ClientError('Cannot parse response')
end end
end end

View File

@ -41,7 +41,6 @@ feature 'Setup Mattermost slash commands', feature: true do
end end
end end
describe 'mattermost service is not enabled' do describe 'mattermost service is not enabled' do
before do before do
allow(Gitlab.config.mattermost).to receive(:enabled).and_return(false) allow(Gitlab.config.mattermost).to receive(:enabled).and_return(false)

View File

@ -10,13 +10,13 @@ describe MattermostSlashCommandsService, :models do
before do before do
allow_any_instance_of(Mattermost::Session).to allow_any_instance_of(Mattermost::Session).to
receive(:with_session).and_yield receive(:with_session).and_yield
end end
subject do subject do
service.configure!(user, team_id: 'abc', service.configure!(user, team_id: 'abc',
trigger: 'gitlab', url: 'http://trigger.url', trigger: 'gitlab', url: 'http://trigger.url',
icon_url: 'http://icon.url/icon.png') icon_url: 'http://icon.url/icon.png')
end end
context 'the requests succeeds' do context 'the requests succeeds' do