From eef89e73c828e6a80db3873ec728cb55e509c4fc Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Mon, 20 Dec 2021 14:49:05 +0000 Subject: [PATCH 1/4] Updates/moves sitemap_spec --- spec/{features => system}/consumer/sitemap_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename spec/{features => system}/consumer/sitemap_spec.rb (94%) diff --git a/spec/features/consumer/sitemap_spec.rb b/spec/system/consumer/sitemap_spec.rb similarity index 94% rename from spec/features/consumer/sitemap_spec.rb rename to spec/system/consumer/sitemap_spec.rb index 47e63f5ac3..9a33b66665 100644 --- a/spec/features/consumer/sitemap_spec.rb +++ b/spec/system/consumer/sitemap_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'spec_helper' +require 'system_helper' describe 'sitemap' do let(:enterprise) { create(:distributor_enterprise) } From c5b14827d08b92bf0c287ba6d0153efdc8ad7e68 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Mon, 20 Dec 2021 14:54:03 +0000 Subject: [PATCH 2/4] 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 From b25e0ed87b353db27504bd8c72338a34c8a65c97 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Mon, 20 Dec 2021 15:13:57 +0000 Subject: [PATCH 3/4] Deletes spec/features/consumer folder --- .github/workflows/build.yml | 1 - spec/system/consumer/sitemap_spec.rb | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e95266dd30..be8b721644 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,7 +34,6 @@ jobs: - "spec/controllers" - "spec/models" - "spec/features/admin/[a-o0-9]*_spec.rb" - - "spec/features/consumer" - "spec/lib" - "spec/migrations" - "spec/serializers" diff --git a/spec/system/consumer/sitemap_spec.rb b/spec/system/consumer/sitemap_spec.rb index abfa8f49fd..43fb4ad557 100644 --- a/spec/system/consumer/sitemap_spec.rb +++ b/spec/system/consumer/sitemap_spec.rb @@ -20,4 +20,4 @@ def return_page(website) 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 +end From b79ae1af7ab56272a6f6ca640bff98e0f8214298 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Tue, 21 Dec 2021 10:51:20 +0000 Subject: [PATCH 4/4] Fixes rubocop offense --- spec/system/consumer/sitemap_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/system/consumer/sitemap_spec.rb b/spec/system/consumer/sitemap_spec.rb index 43fb4ad557..93b3ebe655 100644 --- a/spec/system/consumer/sitemap_spec.rb +++ b/spec/system/consumer/sitemap_spec.rb @@ -19,5 +19,5 @@ 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 + return_page = "http://#{url.host}:#{url.port}#{path}" end