diff options
Diffstat (limited to 'spec/services/mattermost/create_team_service_spec.rb')
-rw-r--r-- | spec/services/mattermost/create_team_service_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/services/mattermost/create_team_service_spec.rb b/spec/services/mattermost/create_team_service_spec.rb new file mode 100644 index 00000000000..b9e5162aab4 --- /dev/null +++ b/spec/services/mattermost/create_team_service_spec.rb @@ -0,0 +1,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 |