diff options
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 |