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:
Diffstat (limited to 'spec/lib/mattermost')
-rw-r--r--spec/lib/mattermost/command_spec.rb7
-rw-r--r--spec/lib/mattermost/team_spec.rb30
2 files changed, 29 insertions, 8 deletions
diff --git a/spec/lib/mattermost/command_spec.rb b/spec/lib/mattermost/command_spec.rb
index 8c4b12c4d03..f38bb273e7d 100644
--- a/spec/lib/mattermost/command_spec.rb
+++ b/spec/lib/mattermost/command_spec.rb
@@ -2,10 +2,15 @@ require 'spec_helper'
describe Mattermost::Command do
let(:session) { double("session") }
+ let(:hash) { { 'token' => 'token' } }
describe '.create' do
+ before do
+ allow(session).to receive(:post).and_return(hash)
+ allow(hash).to receive(:parsed_response).and_return(hash)
+ end
+
it 'gets the teams' do
- allow(session).to receive(:post).and_return('token' => 'token')
expect(session).to receive(:post)
described_class.create(session, 'abc', url: 'http://trigger.com')
diff --git a/spec/lib/mattermost/team_spec.rb b/spec/lib/mattermost/team_spec.rb
index b3db2999070..d4fe63fcd8b 100644
--- a/spec/lib/mattermost/team_spec.rb
+++ b/spec/lib/mattermost/team_spec.rb
@@ -3,23 +3,39 @@ require 'spec_helper'
describe Mattermost::Team do
describe '.team_admin' do
let(:session) { double("session") }
- let(:json) { File.read(Rails.root.join('spec/fixtures/', 'mattermost_initial_load.json')) }
- let(:parsed_response) { JSON.parse(json) }
+
+ let(:response) do
+ [{
+ "id"=>"xiyro8huptfhdndadpz8r3wnbo",
+ "create_at"=>1482174222155,
+ "update_at"=>1482174222155,
+ "delete_at"=>0,
+ "display_name"=>"chatops",
+ "name"=>"chatops",
+ "email"=>"admin@example.com",
+ "type"=>"O",
+ "company_name"=>"",
+ "allowed_domains"=>"",
+ "invite_id"=>"o4utakb9jtb7imctdfzbf9r5ro",
+ "allow_open_invite"=>false}]
+ end
+
+ let(:json) { nil }
before do
- allow(session).to receive(:get).with('/api/v3/users/initial_load').
+ allow(session).to receive(:get).with('/api/v3/teams/all').
and_return(json)
- allow(json).to receive(:parsed_response).and_return(parsed_response)
+ allow(json).to receive(:parsed_response).and_return(response)
end
it 'gets the teams' do
- expect(described_class.team_admin(session).count).to be(2)
+ expect(described_class.all(session).count).to be(1)
end
it 'filters on being team admin' do
- ids = described_class.team_admin(session).map { |team| team['id'] }
+ ids = described_class.all(session).map { |team| team['id'] }
- expect(ids).to include("w59qt5a817f69jkxdz6xe7y4ir", "my9oujxf5jy1zqdgu9rihd66do")
+ expect(ids).to include("xiyro8huptfhdndadpz8r3wnbo")
end
end
end