Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Add specs to cover the desired behavior of the link in a Meeting page

Aaron Contreras875a4cf84318
diff --git a/modules/meeting/spec/features/meetings_show_spec.rb b/modules/meeting/spec/features/meetings_show_spec.rb
index 8bac19650f0..9011dfb12b2 100644
--- a/modules/meeting/spec/features/meetings_show_spec.rb
+++ b/modules/meeting/spec/features/meetings_show_spec.rb
@@ -57,6 +57,28 @@ RSpec.describe 'Meetings', js: true do
text: 'There is currently nothing to display')
end
+ context 'with a location' do
+ context 'as a valid url' do
+ it 'renders a link to the meeting location' do
+ show_page.visit!
+
+ show_page.expect_link_to_location(meeting.location)
+ end
+ end
+
+ context 'as an invalid url' do
+ before do
+ meeting.update!(location: 'badurl')
+ end
+
+ it 'renders the meeting location as plaintext' do
+ show_page.visit!
+
+ show_page.expect_plaintext_location(meeting.location)
+ end
+ end
+ end
+
context 'with an open agenda' do
let!(:agenda) { create(:meeting_agenda, meeting:, text: 'foo') }
let(:agenda_update) { create(:meeting_agenda, meeting:, text: 'bla') }
diff --git a/modules/meeting/spec/support/pages/meetings/show.rb b/modules/meeting/spec/support/pages/meetings/show.rb
index a52a54b7257..cc87bacd8af 100644
--- a/modules/meeting/spec/support/pages/meetings/show.rb
+++ b/modules/meeting/spec/support/pages/meetings/show.rb
@@ -48,7 +48,7 @@ module Pages::Meetings
def expect_invited(*users)
users.each do |user|
- within(".meeting.details") do
+ within(meeting_details_container) do
expect(page)
.to have_link(user.name)
end
@@ -57,7 +57,7 @@ module Pages::Meetings
def expect_uninvited(*users)
users.each do |user|
- within(".meeting.details") do
+ within(meeting_details_container) do
expect(page)
.not_to have_link(user.name)
end
@@ -69,6 +69,23 @@ module Pages::Meetings
.to have_content("Time: #{expected}")
end
+ def expect_link_to_location(location)
+ within(meeting_details_container) do
+ expect(page).to have_link location
+ end
+ end
+
+ def expect_plaintext_location(location)
+ within(meeting_details_container) do
+ expect(page).not_to have_link location
+ expect(page).to have_text(location)
+ end
+ end
+
+ def meeting_details_container
+ find('.meeting.details')
+ end
+
def click_edit
within '.meeting--main-toolbar .toolbar-items' do
click_link 'Edit'