diff options
author | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-02-20 13:41:50 +0100 |
---|---|---|
committer | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-02-20 13:41:50 +0100 |
commit | 444d71e043eb19979ec1b08504b2760910cb2a47 (patch) | |
tree | eae73ba8a12de1a84faee800fae9749b70ed1b78 /spec/services | |
parent | 549fc3469790da388035de713294f335fbfb4fb5 (diff) | |
download | gitlab-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')
-rw-r--r-- | spec/services/groups/create_service_spec.rb | 11 |
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 |