summaryrefslogtreecommitdiff
path: root/spec/lib/mattermost/team_spec.rb
blob: 704579f0f48ab44e0566f6044e471b9f006f192b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
require 'spec_helper'

describe Mattermost::Team do
  describe '#all' do
    let(:user) { build(:user) }
    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

    subject { described_class.new(user) }

    before do
      allow(subject).to receive(:json_get).and_return(response)
    end

    it 'gets the teams' do
      expect(subject.all.count).to be(1)
    end
  end
end