diff options
| author | Peter Leitzen <pleitzen@gitlab.com> | 2019-09-04 17:38:58 +0200 |
|---|---|---|
| committer | Peter Leitzen <pleitzen@gitlab.com> | 2019-09-04 17:38:58 +0200 |
| commit | 511d81f48043fd0d4c6be7bb5692162de5c36eab (patch) | |
| tree | 7796b4e7d3e18055fde5f5973dce440d05ef8774 | |
| parent | fd4c56a951c295558a8e78e52fa932f34d58f4f7 (diff) | |
| download | gitlab-ce-66360-zoom-for-incident-management-model.tar.gz | |
Implement pending specs66360-zoom-for-incident-management-model
| -rw-r--r-- | spec/models/zoom_meeting_spec.rb | 46 |
1 files changed, 41 insertions, 5 deletions
diff --git a/spec/models/zoom_meeting_spec.rb b/spec/models/zoom_meeting_spec.rb index 389d2e345bb..392a241fa5f 100644 --- a/spec/models/zoom_meeting_spec.rb +++ b/spec/models/zoom_meeting_spec.rb @@ -68,14 +68,50 @@ describe ZoomMeeting do end describe 'limit number of meetings per issue' do - shared_examples 'can add a meeting to issue' + shared_examples 'can add meetings' do + it 'can add new Zoom meetings' do + create(:zoom_meeting, :added_to_issue, issue: issue) + end + end - shared_examples 'cannot add a meeting to issue' + shared_examples 'cannot add meetings' do + it 'fails to add a new meeting' do + expect do + create(:zoom_meeting, :added_to_issue, issue: issue) + end.to raise_error ActiveRecord::RecordNotUnique + end + end - context 'when no other Zoom meeting is added' + let(:issue) { create(:issue, project: project) } - context 'when Zoom meeting is already added' + context 'without meetings' do + it_behaves_like 'can add meetings' + end + + context 'when no other meeting is added' do + before do + create(:zoom_meeting, :removed_from_issue, issue: issue) + end + + it_behaves_like 'can add meetings' + end - context 'when Zoom meeting is already added to another issue' + context 'when meeting is added' do + before do + create(:zoom_meeting, :added_to_issue, issue: issue) + end + + it_behaves_like 'cannot add meetings' + end + + context 'when meeting is added to another issue' do + let(:another_issue) { create(:issue, project: project) } + + before do + create(:zoom_meeting, :added_to_issue, issue: another_issue) + end + + it_behaves_like 'can add meetings' + end end end |
