diff options
Diffstat (limited to 'spec/helpers/issuables_helper_spec.rb')
-rw-r--r-- | spec/helpers/issuables_helper_spec.rb | 55 |
1 files changed, 33 insertions, 22 deletions
diff --git a/spec/helpers/issuables_helper_spec.rb b/spec/helpers/issuables_helper_spec.rb index 2f67ea457a0..1af8b7390bb 100644 --- a/spec/helpers/issuables_helper_spec.rb +++ b/spec/helpers/issuables_helper_spec.rb @@ -203,42 +203,53 @@ describe IssuablesHelper do end describe '#zoomMeetingUrl in issue' do - let(:issue) { create(:issue, author: user, description: description) } + let(:issue) { create(:issue, author: user) } before do assign(:project, issue.project) end - context 'no zoom links in the issue description' do - let(:description) { 'issue text' } - - it 'does not set zoomMeetingUrl' do - expect(helper.issuable_initial_data(issue)) - .not_to include(:zoomMeetingUrl) + shared_examples 'sets zoomMeetingUrl to nil' do + specify do + expect(helper.issuable_initial_data(issue)[:zoomMeetingUrl]) + .to be_nil end end - context 'no zoom links in the issue description if it has link but not a zoom link' do - let(:description) { 'issue text https://stackoverflow.com/questions/22' } + context 'with no "added" zoom mettings' do + it_behaves_like 'sets zoomMeetingUrl to nil' + + context 'with multiple removed meetings' do + before do + create(:zoom_meeting, issue: issue, issue_status: :removed) + create(:zoom_meeting, issue: issue, issue_status: :removed) + end - it 'does not set zoomMeetingUrl' do - expect(helper.issuable_initial_data(issue)) - .not_to include(:zoomMeetingUrl) + it_behaves_like 'sets zoomMeetingUrl to nil' end end - context 'with two zoom links in description' do - let(:description) do - <<~TEXT - issue text and - zoom call on https://zoom.us/j/123456789 this url - and new zoom url https://zoom.us/s/lastone and some more text - TEXT + context 'with "added" zoom meeting' do + before do + create(:zoom_meeting, issue: issue) end - it 'sets zoomMeetingUrl value to the last url' do - expect(helper.issuable_initial_data(issue)) - .to include(zoomMeetingUrl: 'https://zoom.us/s/lastone') + shared_examples 'sets zoomMeetingUrl to canonical meeting url' do + specify do + expect(helper.issuable_initial_data(issue)) + .to include(zoomMeetingUrl: 'https://zoom.us/j/123456789') + end + end + + it_behaves_like 'sets zoomMeetingUrl to canonical meeting url' + + context 'with muliple "removed" zoom meetings' do + before do + create(:zoom_meeting, issue: issue, issue_status: :removed) + create(:zoom_meeting, issue: issue, issue_status: :removed) + end + + it_behaves_like 'sets zoomMeetingUrl to canonical meeting url' end end end |