diff options
author | Z.J. van de Weg <git@zjvandeweg.nl> | 2016-12-16 17:45:56 +0300 |
---|---|---|
committer | Z.J. van de Weg <git@zjvandeweg.nl> | 2016-12-16 17:51:43 +0300 |
commit | 7363a7d3b5804493f86531bebb1610afb91b5293 (patch) | |
tree | 2b02129b40b30995d7f938b7e248c4e58d7e8ea1 /spec/lib/mattermost/team_spec.rb | |
parent | 475a4dc34dd775147dafebcf1b4d648bf2b9aeec (diff) |
Add tests for auto configure slash commands
Diffstat (limited to 'spec/lib/mattermost/team_spec.rb')
-rw-r--r-- | spec/lib/mattermost/team_spec.rb | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/spec/lib/mattermost/team_spec.rb b/spec/lib/mattermost/team_spec.rb index a3b0831659f..0fe6163900d 100644 --- a/spec/lib/mattermost/team_spec.rb +++ b/spec/lib/mattermost/team_spec.rb @@ -1,19 +1,22 @@ require 'spec_helper' describe Mattermost::Team do - let(:session) { Mattermost::Session.new('http://localhost:8065/', nil) } + describe '.team_admin' do + let(:init_load) do + JSON.parse(File.read(Rails.root.join('spec/fixtures/', 'mattermost_initial_load.json'))) + end - describe '.all' do - let(:result) { {id: 'abc', display_name: 'team'} } before do - WebMock.stub_request(:get, 'http://localhost:8065/api/v3/teams/all'). - and_return({ abc: result }.to_json) + allow(described_class).to receive(:initial_load).and_return(init_load) end - xit 'gets the teams' do - allow(session).to receive(:with_session) { yield } + it 'gets the teams' do + expect(described_class.team_admin.count).to be(2) + end - expect(described_class.all).to eq(result) + it 'filters on being team admin' do + ids = described_class.team_admin.map { |team| team['id'] } + expect(ids).to include("w59qt5a817f69jkxdz6xe7y4ir", "my9oujxf5jy1zqdgu9rihd66do") end end end |