Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZ.J. van de Weg <git@zjvandeweg.nl>2016-12-19 16:14:09 +0300
committerZ.J. van de Weg <git@zjvandeweg.nl>2016-12-19 16:14:09 +0300
commit6d14a6640f89893792ad6c66b7f4362ef4ff9007 (patch)
tree7109c818a61f5b92e34e5202a7a544d1d191ad62 /spec/lib/mattermost
parent4213bd56dea1d6cdbfa8baed8faa7e3ab86e61ab (diff)
Minor adjustments API Mattermost
[ci skip]
Diffstat (limited to 'spec/lib/mattermost')
-rw-r--r--spec/lib/mattermost/command_spec.rb13
-rw-r--r--spec/lib/mattermost/session_spec.rb2
-rw-r--r--spec/lib/mattermost/team_spec.rb15
3 files changed, 15 insertions, 15 deletions
diff --git a/spec/lib/mattermost/command_spec.rb b/spec/lib/mattermost/command_spec.rb
index 7c6457f639d..8c4b12c4d03 100644
--- a/spec/lib/mattermost/command_spec.rb
+++ b/spec/lib/mattermost/command_spec.rb
@@ -1,17 +1,14 @@
require 'spec_helper'
describe Mattermost::Command do
- describe '.create' do
- let(:new_command) do
- JSON.parse(File.read(Rails.root.join('spec/fixtures/', 'mattermost_new_command.json')))
- end
+ let(:session) { double("session") }
+ describe '.create' do
it 'gets the teams' do
- allow(described_class).to receive(:post_command).and_return(new_command)
-
- token = described_class.create('abc', url: 'http://trigger.url/trigger', icon_url: 'http://myicon.com/icon.png')
+ allow(session).to receive(:post).and_return('token' => 'token')
+ expect(session).to receive(:post)
- expect(token).to eq('pzajm5hfbtni3r49ujpt8betpc')
+ described_class.create(session, 'abc', url: 'http://trigger.com')
end
end
end
diff --git a/spec/lib/mattermost/session_spec.rb b/spec/lib/mattermost/session_spec.rb
index 752ac796b1c..3c2eddbd221 100644
--- a/spec/lib/mattermost/session_spec.rb
+++ b/spec/lib/mattermost/session_spec.rb
@@ -96,4 +96,4 @@ describe Mattermost::Session, type: :request do
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/lib/mattermost/team_spec.rb b/spec/lib/mattermost/team_spec.rb
index 0fe6163900d..b3db2999070 100644
--- a/spec/lib/mattermost/team_spec.rb
+++ b/spec/lib/mattermost/team_spec.rb
@@ -2,20 +2,23 @@ require 'spec_helper'
describe Mattermost::Team do
describe '.team_admin' do
- let(:init_load) do
- JSON.parse(File.read(Rails.root.join('spec/fixtures/', 'mattermost_initial_load.json')))
- end
+ let(:session) { double("session") }
+ let(:json) { File.read(Rails.root.join('spec/fixtures/', 'mattermost_initial_load.json')) }
+ let(:parsed_response) { JSON.parse(json) }
before do
- allow(described_class).to receive(:initial_load).and_return(init_load)
+ allow(session).to receive(:get).with('/api/v3/users/initial_load').
+ and_return(json)
+ allow(json).to receive(:parsed_response).and_return(parsed_response)
end
it 'gets the teams' do
- expect(described_class.team_admin.count).to be(2)
+ expect(described_class.team_admin(session).count).to be(2)
end
it 'filters on being team admin' do
- ids = described_class.team_admin.map { |team| team['id'] }
+ ids = described_class.team_admin(session).map { |team| team['id'] }
+
expect(ids).to include("w59qt5a817f69jkxdz6xe7y4ir", "my9oujxf5jy1zqdgu9rihd66do")
end
end