From c5b14827d08b92bf0c287ba6d0153efdc8ad7e68 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Mon, 20 Dec 2021 14:54:03 +0000 Subject: [PATCH] Adds URL port to the assertion --- spec/system/consumer/sitemap_spec.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/spec/system/consumer/sitemap_spec.rb b/spec/system/consumer/sitemap_spec.rb index 9a33b66665..abfa8f49fd 100644 --- a/spec/system/consumer/sitemap_spec.rb +++ b/spec/system/consumer/sitemap_spec.rb @@ -8,7 +8,16 @@ describe 'sitemap' do it "renders sitemap" do visit '/sitemap.xml' - expect(page).to have_content enterprise_shop_url(enterprise) - expect(page).to have_content group_url(group) + expect(page.source).to have_content return_page(enterprise_shop_url(enterprise)) + expect(page.source).to have_content return_page(group_url(group)) end end + +private + +def return_page(website) + # routing does not include the port of the session, this method adds it + url = URI(page.driver.browser.url) + path = URI(website).path + return_page = "http://" + url.host.to_s + ':' + url.port.to_s + path +end \ No newline at end of file