summaryrefslogtreecommitdiff
path: root/spec/services/groups/create_service_spec.rb
diff options
context:
space:
mode:
authorZ.J. van de Weg <git@zjvandeweg.nl>2017-02-20 13:41:50 +0100
committerZ.J. van de Weg <git@zjvandeweg.nl>2017-02-20 13:41:50 +0100
commit444d71e043eb19979ec1b08504b2760910cb2a47 (patch)
treeeae73ba8a12de1a84faee800fae9749b70ed1b78 /spec/services/groups/create_service_spec.rb
parent549fc3469790da388035de713294f335fbfb4fb5 (diff)
downloadgitlab-ce-444d71e043eb19979ec1b08504b2760910cb2a47.tar.gz
Transactional mattermost team creation
Before this commit, but still on this feature branch, the creation of mattermost teams where a background job. However, it was decided it was better that these happened as transaction so feedback could be displayed to the user.
Diffstat (limited to 'spec/services/groups/create_service_spec.rb')
-rw-r--r--spec/services/groups/create_service_spec.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/spec/services/groups/create_service_spec.rb b/spec/services/groups/create_service_spec.rb
index 235fa5c5188..d8181f73110 100644
--- a/spec/services/groups/create_service_spec.rb
+++ b/spec/services/groups/create_service_spec.rb
@@ -43,10 +43,17 @@ describe Groups::CreateService, '#execute', services: true do
let!(:params) { group_params.merge(create_chat_team: true) }
let!(:service) { described_class.new(user, params) }
- it 'queues a background job' do
- expect(Mattermost::CreateTeamWorker).to receive(:perform_async)
+ it 'triggers the service' do
+ expect_any_instance_of(Mattermost::CreateTeamService).to receive(:execute)
subject
end
+
+ it 'create the chat team with the group' do
+ allow_any_instance_of(Mattermost::Team).to receive(:create)
+ .and_return({ 'name' => 'tanuki', 'id' => 'lskdjfwlekfjsdifjj' })
+
+ expect { subject }.to change { ChatTeam.count }.from(0).to(1)
+ end
end
end