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 ...@@ -30,12 +30,12 @@ module Mattermost
json_response = JSON.parse(response.body) json_response = JSON.parse(response.body)
unless response.success? unless response.success?
raise ClientError(json_response['message'] || 'Undefined error') raise Mattermost::ClientError.new(json_response['message'] || 'Undefined error')
end end
json_response json_response
rescue JSON::JSONError rescue JSON::JSONError
raise ClientError('Cannot parse response') raise Mattermost::ClientError.new('Cannot parse response')
end end
end end
end end
...@@ -81,9 +81,9 @@ module Mattermost ...@@ -81,9 +81,9 @@ module Mattermost
def post(path, options = {}) def post(path, options = {})
self.class.post(path, options.merge(headers: @headers)) self.class.post(path, options.merge(headers: @headers))
rescue HTTParty::Error => e rescue HTTParty::Error => e
raise ConnectionError(e.message) raise Mattermost::ConnectionError.new(e.message)
rescue Errno::ECONNREFUSED rescue Errno::ECONNREFUSED
raise ConnectionError raise Mattermost::ConnectionError.new(e.message)
end end
private private
......
...@@ -3,9 +3,6 @@ require 'spec_helper' ...@@ -3,9 +3,6 @@ require 'spec_helper'
describe Mattermost::Team do describe Mattermost::Team do
describe '#all' do describe '#all' do
let(:user) { build(:user) } let(:user) { build(:user) }
subject { described_class.new(user) }
let(:response) do let(:response) do
[{ [{
"id" => "xiyro8huptfhdndadpz8r3wnbo", "id" => "xiyro8huptfhdndadpz8r3wnbo",
...@@ -22,6 +19,7 @@ describe Mattermost::Team do ...@@ -22,6 +19,7 @@ describe Mattermost::Team do
"allow_open_invite" => false }] "allow_open_invite" => false }]
end end
subject { described_class.new(user) }
before do before do
allow(subject).to receive(:json_get).and_return(response) 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