blob: b9e5162aab487292113365a17db58fac1c75aa3f (
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
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mattermost::CreateTeamService, feature_category: :integrations do
let(:user) { create(:user) }
let(:group) { create(:group) }
subject { described_class.new(group, user) }
it 'creates a team' do
expect_next_instance_of(::Mattermost::Team) do |instance|
expect(instance).to receive(:create).with(name: anything, display_name: anything, type: anything)
end
subject.execute
end
it 'adds an error if a team could not be created' do
expect_next_instance_of(::Mattermost::Team) do |instance|
expect(instance).to receive(:create).and_raise(::Mattermost::ClientError, 'client error')
end
subject.execute
expect(group.errors).to be_present
end
end
|