diff options
Diffstat (limited to 'spec/support/shared_examples/quick_actions/issue/zoom_quick_actions_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/quick_actions/issue/zoom_quick_actions_shared_examples.rb | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/spec/support/shared_examples/quick_actions/issue/zoom_quick_actions_shared_examples.rb b/spec/support/shared_examples/quick_actions/issue/zoom_quick_actions_shared_examples.rb index b4a8e3fca4d..92bbc4abe77 100644 --- a/spec/support/shared_examples/quick_actions/issue/zoom_quick_actions_shared_examples.rb +++ b/spec/support/shared_examples/quick_actions/issue/zoom_quick_actions_shared_examples.rb @@ -2,22 +2,19 @@ shared_examples 'zoom quick actions' do let(:zoom_link) { 'https://zoom.us/j/123456789' } + let(:existing_zoom_link) { 'https://zoom.us/j/123456780' } let(:invalid_zoom_link) { 'https://invalid-zoom' } - before do - issue.update!(description: description) - end - describe '/zoom' do shared_examples 'skip silently' do - it 'skip addition silently' do + it 'skips addition silently' do add_note("/zoom #{zoom_link}") wait_for_requests expect(page).not_to have_content('Zoom meeting added') expect(page).not_to have_content('Failed to add a Zoom meeting') - expect(issue.reload.description).to eq(description) + expect(ZoomMeeting.canonical_meeting_url(issue.reload)).not_to eq(zoom_link) end end @@ -28,13 +25,11 @@ shared_examples 'zoom quick actions' do wait_for_requests expect(page).to have_content('Zoom meeting added') - expect(issue.reload.description).to end_with(zoom_link) + expect(ZoomMeeting.canonical_meeting_url(issue.reload)).to eq(zoom_link) end end - context 'without issue description' do - let(:description) { nil } - + context 'without zoom_meetings' do include_examples 'success' it 'cannot add invalid zoom link' do @@ -47,14 +42,18 @@ shared_examples 'zoom quick actions' do end end - context 'with Zoom link not at the end of the issue description' do - let(:description) { "A link #{zoom_link} not at the end" } + context 'with "removed" zoom meeting' do + before do + create(:zoom_meeting, issue_status: :removed, url: existing_zoom_link, issue: issue) + end include_examples 'success' end - context 'with Zoom link at end of the issue description' do - let(:description) { "Text\n#{zoom_link}" } + context 'with "added" zoom meeting' do + before do + create(:zoom_meeting, issue_status: :added, url: existing_zoom_link, issue: issue) + end include_examples 'skip silently' end @@ -62,19 +61,19 @@ shared_examples 'zoom quick actions' do describe '/remove_zoom' do shared_examples 'skip silently' do - it 'skip removal silently' do + it 'skips removal silently' do add_note('/remove_zoom') wait_for_requests expect(page).not_to have_content('Zoom meeting removed') expect(page).not_to have_content('Failed to remove a Zoom meeting') - expect(issue.reload.description).to eq(description) + expect(ZoomMeeting.canonical_meeting_url(issue.reload)).to be_nil end end - context 'with Zoom link in the description' do - let(:description) { "Text with #{zoom_link}\n\n\n#{zoom_link}" } + context 'with added zoom meeting' do + let!(:added_zoom_meeting) { create(:zoom_meeting, url: zoom_link, issue: issue, issue_status: :added) } it 'removes last Zoom link' do add_note('/remove_zoom') @@ -82,14 +81,8 @@ shared_examples 'zoom quick actions' do wait_for_requests expect(page).to have_content('Zoom meeting removed') - expect(issue.reload.description).to eq("Text with #{zoom_link}") + expect(ZoomMeeting.canonical_meeting_url(issue.reload)).to be_nil end end - - context 'with a Zoom link not at the end of the description' do - let(:description) { "A link #{zoom_link} not at the end" } - - include_examples 'skip silently' - end end end |