Commit 22a05678 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Fix a few error messages

parent 70dcd45d
module MattermostHelper
def mattermost_teams_options(teams)
teams_options = teams.map do |id, options|
[options['display_name'] || options['name'], id]
end
teams_options.compact.unshift(['Select team...', '0'])
end
end
#!/bin/bash
set -xe
# rsync --delete -av config/{routes.rb,routes,initializers,application.rb} zj-gitlab:/opt/gitlab/embedded/service/gitlab-rails/config/
rsync --delete -av lib/mattermost zj-gitlab:/opt/gitlab/embedded/service/gitlab-rails/lib
# rsync --delete -av vendor/{assets,gitignore,gitlab-ci-yml} zj-gitlab:/opt/gitlab/embedded/service/gitlab-rails/vendor/
# rsync --delete -av ../gitlab-shell/{bin,lib,spec,hooks} zj-gitlab:/opt/gitlab/embedded/service/gitlab-shell
#ssh gitlab-test 'cd /opt/gitlab/embedded/service/gitlab-rails && /opt/gitlab/embedded/bin/bundle install --deployment'
#ssh gitlab-test 'export NO_PRIVILEGE_DROP=true; export USE_DB=false; gitlab-rake assets:precompile'
ssh zj-gitlab gitlab-ctl restart
......@@ -30,12 +30,12 @@ module Mattermost
json_response = JSON.parse(response.body)
unless response.success?
raise ClientError(json_response['message'] || 'Undefined error')
raise Mattermost::ClientError.new(json_response['message'] || 'Undefined error')
end
json_response
rescue JSON::JSONError
raise ClientError('Cannot parse response')
raise Mattermost::ClientError.new('Cannot parse response')
end
end
end
......@@ -81,9 +81,9 @@ module Mattermost
def post(path, options = {})
self.class.post(path, options.merge(headers: @headers))
rescue HTTParty::Error => e
raise ConnectionError(e.message)
raise Mattermost::ConnectionError.new(e.message)
rescue Errno::ECONNREFUSED
raise ConnectionError
raise Mattermost::ConnectionError.new(e.message)
end
private
......
......@@ -3,9 +3,6 @@ require 'spec_helper'
describe Mattermost::Team do
describe '#all' do
let(:user) { build(:user) }
subject { described_class.new(user) }
let(:response) do
[{
"id" => "xiyro8huptfhdndadpz8r3wnbo",
......@@ -22,6 +19,7 @@ describe Mattermost::Team do
"allow_open_invite" => false }]
end
subject { described_class.new(user) }
before do
allow(subject).to receive(:json_get).and_return(response)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment